@@ -269,7 +269,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
private Account getOneByEmailAndOrganizationName ( String email , String organizationName ) {
QueryWrapper < Account > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( " BINARY user_email" , email ) ;
queryWrapper . eq ( " user_email " , email ) ;
if ( StringUtils . isNotBlank ( organizationName ) ) {
queryWrapper . eq ( " organization_name " , organizationName ) ;
}
@@ -381,7 +381,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountExtend . setAccountId ( accountOld . getId ( ) ) ;
accountExtendMapper . updateById ( accountExtend ) ;
accountMapper. deleteById( userHolder. getId ( ) ) ;
// accountMapper. deleteById( userHolder.getId()) ;
log . info ( " 排查用户被删除原因: 绑定邮箱, POST, 删除用户( 改为降为游客) " ) ;
accountMapper . toVisitor ( userHolder . getId ( ) ) ;
String token = LocalCacheUtils . getTokenCache ( String . valueOf ( accountOld . getId ( ) ) ) ;
if ( StringUtils . isNotBlank ( token ) ) {
@@ -451,7 +453,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
private Account getOneByEmail ( String email ) {
QueryWrapper < Account > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper. eq ( " BINARY user_email" , email ) ;
// queryWrapper.eq(" BINARY user_email", email) ;
queryWrapper . eq ( " user_email " , email ) ;
List < Account > accountList = accountMapper . selectList ( queryWrapper ) ;
if ( CollectionUtil . isEmpty ( accountList ) ) {
throw new BusinessException ( " email.does.not.exist " , ResultEnum . PROMPT . getCode ( ) ) ;
@@ -805,11 +808,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
LocalCacheUtils . delTokenCache ( String . valueOf ( accountDelete . getId ( ) ) ) ;
}
if ( ! userName . equals ( userToBeUpdate . getUserName ( ) ) ) {
accountMapper. deleteById( accountDelete) ;
// accountMapper. deleteById( accountDelete) ;
log . info ( " 排查用户被删除原因: deleteNoLoginRequired, true, 删除用户(改为降为游客) " ) ;
accountMapper . toVisitor ( accountDelete . getId ( ) ) ;
userToBeUpdate . setUserName ( userName ) ;
accountMapper . updateById ( userToBeUpdate ) ;
} else {
accountMapper. deleteById( accountDelete) ;
// accountMapper. deleteById( accountDelete) ;
log . info ( " 排查用户被删除原因: deleteNoLoginRequired, false, 删除用户(改为降为游客) " ) ;
accountMapper . toVisitor ( accountDelete . getId ( ) ) ;
}
}
}
@@ -1053,7 +1060,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
if ( StringUtils . isNotBlank ( token ) ) {
LocalCacheUtils . delTokenCache ( String . valueOf ( account . getId ( ) ) ) ;
}
accountMapper. deleteById( account. getId ( ) ) ;
// accountMapper. deleteById( account.getId()) ;
log . info ( " 排查用户被删除原因: deleteNoLoginRequiredNew, 删除用户( 改为降为游客) " ) ;
accountMapper . toVisitor ( account . getId ( ) ) ;
// TODO:注销时删除用户数据, workspace, like, library等
}
}
@@ -1209,11 +1218,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
String userEmail = accountDesignWorksRegisterDTO . getUserEmail ( ) ;
log . info ( " 注册账号。邮箱:{} " , userEmail ) ;
QueryWrapper < Account > qwA = new QueryWrapper < > ( ) ;
qwA . eq ( " BINARY user_email" , userEmail ) ;
qwA . eq ( " user_email " , userEmail ) ;
List < Account > accountList = accountMapper . selectList ( qwA ) ;
QueryWrapper < TrialOrder > qwT = new QueryWrapper < > ( ) ;
qwT . eq ( " BINARY email" , userEmail ) ;
qwT . eq ( " email " , userEmail ) ;
List < TrialOrder > trialOrders = trialOrderMapper . selectList ( qwT ) ;
if ( CollectionUtil . isNotEmpty ( accountList ) | | CollectionUtil . isNotEmpty ( trialOrders ) ) {
throw new BusinessException ( " The email has already been registered " ) ;
@@ -2676,11 +2685,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
}
@Override
/* @Override
public Boolean deleteSubAccount(AddSubAccountDTO addSubAccountDTO) {
accountMapper.deleteBatchIds(addSubAccountDTO.getDeleteIdList());
return Boolean.TRUE;
}
}*/
public void removeSubAccount ( AddSubAccountDTO addSubAccountDTO ) {
Long adminAccId = UserContext . getUserHolder ( ) . getId ( ) ;
@@ -3172,6 +3181,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
@Override
@Transactional
public AccountExtend bindWeChat ( String code ) {
log . info ( " code:{} " , code ) ;
// 1. 获取 access_token 和 openid
JSONObject accessTokenResponse = getAccessTokenFromWeChat ( code ) ;
String accessToken = accessTokenResponse . getString ( " access_token " ) ;
@@ -3200,7 +3210,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
AccountExtend accountExtend = accountExtends . get ( 0 ) ;
AuthPrincipalVo authPrincipalVo = UserContext . getUserHolder ( ) ;
accountMapper. deleteById( accountExtend. getAccountId( ) ) ;
// accountMapper. deleteById( accountExtend. getAccountId()) ;
log . info ( " 排查用户被删除原因: bindWeChat, 删除用户( 改为降为游客) " ) ;
accountMapper . toVisitor ( accountExtend . getAccountId ( ) ) ;
accountExtend . setAccountId ( authPrincipalVo . getId ( ) ) ;
accountExtendMapper . updateById ( accountExtend ) ;
@@ -3260,7 +3272,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountExtend . setAccountId ( account . getId ( ) ) ;
accountExtendMapper . updateById ( accountExtend ) ;
accountMapper. deleteById( userHolder. getId ( ) ) ;
// accountMapper. deleteById( userHolder.getId()) ;
log . info ( " 排查用户被删除原因: bindEmail, GET, 删除用户( 改为降为游客) " ) ;
accountMapper . toVisitor ( accountExtend . getAccountId ( ) ) ;
String token = LocalCacheUtils . getTokenCache ( String . valueOf ( account . getId ( ) ) ) ;
if ( StringUtils . isNotBlank ( token ) ) {
@@ -3495,6 +3509,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
addSubAccountDTO . setUserName ( dto . getEmail ( ) . substring ( 0 , dto . getEmail ( ) . indexOf ( " @ " ) ) ) ;
addSubAccountDTO . setUserPassword ( md5 ( " 123456abc " ) ) ;
addSubAccountDTO . setCreditsUsage ( BigDecimal . ZERO ) ;
addSubAccountDTO . setValidStartTime ( parent . getValidStartTime ( ) ) ;
addSubAccountDTO . setValidEndTime ( parent . getValidEndTime ( ) ) ;
// 添加用户
addSubAccount ( addSubAccountDTO ) ;
}