|
|
@@ -282,7 +282,7 @@ public class UserService {
|
|
|
|
|
|
public User loginByPhone(String phone, String code, String inviteCode) {
|
|
|
User user = userRepo.findByPhoneAndDelFalse(phone).orElse(null);
|
|
|
-// smsService.verify(phone, code);
|
|
|
+ smsService.verify(phone, code);
|
|
|
if (user == null) {
|
|
|
String name = "nft_" + RandomStringUtils.randomAlphabetic(8);
|
|
|
ResponseEntity<UserSynchronizationDto> result = restTemplateUtils.post(url, phone, UserSynchronizationDto.class);
|
|
|
@@ -299,38 +299,42 @@ public class UserService {
|
|
|
.shareRatio(sysConfigService.getBigDecimal("share_ratio"))
|
|
|
.authStatus(AuthStatus.NOT_AUTH)
|
|
|
.build();
|
|
|
- save(user);
|
|
|
-// if (body.getAuthStatus().equals(AuthStatus.SUCCESS)){
|
|
|
-// IdentityAuth identityAuth = IdentityAuth.builder()
|
|
|
-// .autoValidated(true)
|
|
|
-// .idNo(body.getIdNo())
|
|
|
-// .phone(phone)
|
|
|
-// .realName(body.getRealName())
|
|
|
-// .status(body.getAuthStatus())
|
|
|
-// .userId(user.getId())
|
|
|
-// .build();
|
|
|
-// identityAuth = identityAuthRepo.save(identityAuth);
|
|
|
-// user.setAuthStatus(body.getAuthStatus());
|
|
|
-// user.setAuthId(identityAuth.getId());
|
|
|
-// if (body.getIsUserBankCard()){
|
|
|
-// user.setIsUserBankCard(body.getIsUserBankCard());
|
|
|
-// user.setMemberId("1");
|
|
|
-// user.setSettleAccountId("1");
|
|
|
-// BankValidate bankValidate = BankUtils.validate(body.getBankNo());
|
|
|
-// userBankCardRepo.save(UserBankCard.builder()
|
|
|
-// .bank(bankValidate.getBank())
|
|
|
-// .bankName(bankValidate.getBankName())
|
|
|
-// .bankNo(body.getBankNo())
|
|
|
-// .cardType(bankValidate.getCardType())
|
|
|
-// .cardTypeDesc(bankValidate.getCardTypeDesc())
|
|
|
-// .userId(user.getId())
|
|
|
-// .phone(phone)
|
|
|
-// .realName(identityAuth.getRealName())
|
|
|
-// .idNo(identityAuth.getIdNo())
|
|
|
-// .build());
|
|
|
-// }
|
|
|
-// save(user);
|
|
|
-// }
|
|
|
+ user = save(user);
|
|
|
+ if (body.getAuthStatus().equals(AuthStatus.SUCCESS)){
|
|
|
+ IdentityAuth identityAuth = IdentityAuth.builder()
|
|
|
+ .autoValidated(true)
|
|
|
+ .idNo(body.getIdNo())
|
|
|
+ .phone(phone)
|
|
|
+ .realName(body.getRealName())
|
|
|
+ .status(body.getAuthStatus())
|
|
|
+ .userId(user.getId())
|
|
|
+ .build();
|
|
|
+ identityAuth = identityAuthRepo.save(identityAuth);
|
|
|
+ user.setAuthStatus(body.getAuthStatus());
|
|
|
+ user.setAuthId(identityAuth.getId());
|
|
|
+ if (body.getIsUserBankCard()){
|
|
|
+ user.setIsUserBankCard(body.getIsUserBankCard());
|
|
|
+ user.setMemberId("1");
|
|
|
+ user.setSettleAccountId("1");
|
|
|
+ BankValidate bankValidate = BankUtils.validate(body.getBankNo());
|
|
|
+ userBankCardRepo.save(UserBankCard.builder()
|
|
|
+ .bank(bankValidate.getBank())
|
|
|
+ .bankName(bankValidate.getBankName())
|
|
|
+ .bankNo(body.getBankNo())
|
|
|
+ .cardType(bankValidate.getCardType())
|
|
|
+ .cardTypeDesc(bankValidate.getCardTypeDesc())
|
|
|
+ .userId(user.getId())
|
|
|
+ .phone(phone)
|
|
|
+ .realName(identityAuth.getRealName())
|
|
|
+ .idNo(identityAuth.getIdNo())
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ if (user.getIsUserBankCard()){
|
|
|
+ userRepo.setAuthStatusAndAuthId(user.getId(),body.getAuthStatus(),identityAuth.getId(),body.getIsUserBankCard());
|
|
|
+ }else {
|
|
|
+ userRepo.setAuthStatus(user.getId(),body.getAuthStatus(),identityAuth.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}else {
|
|
|
user = create(UserRegister.builder()
|
|
|
.authorities(Collections.singleton(Authority.get(AuthorityName.ROLE_USER)))
|