Merge branch 'main' of https://gitea.haiyihy.com/hy/chatapp3-java
This commit is contained in:
commit
7ead4fcc85
@ -39,7 +39,7 @@ public enum ConsoleAccountStatusEnum {
|
|||||||
/**
|
/**
|
||||||
* 账号解封.
|
* 账号解封.
|
||||||
*/
|
*/
|
||||||
UNTIE_ACOOUNT("UNTIE_DEVICE", "账号解封"),
|
UNTIE_ACOOUNT("UNTIE_ACOOUNT", "账号解封"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备+账户解封.
|
* 设备+账户解封.
|
||||||
|
|||||||
@ -246,10 +246,10 @@ public class UserAccountCommon {
|
|||||||
* 解封账号.
|
* 解封账号.
|
||||||
*/
|
*/
|
||||||
public void unblock(UnblockAccountCmd cmd) {
|
public void unblock(UnblockAccountCmd cmd) {
|
||||||
userProfileGateway.removeCacheAll(cmd.getBeOptUserId());
|
|
||||||
if (!baseInfoService.updateAccountStatus(cmd.getBeOptUserId(), AccountStatusEnum.NORMAL)) {
|
if (!baseInfoService.updateAccountStatus(cmd.getBeOptUserId(), AccountStatusEnum.NORMAL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
userProfileGateway.removeCacheAll(cmd.getBeOptUserId());
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
approvalUserAccountStatusLogService.save(new ApprovalUserAccountStatusLog()
|
approvalUserAccountStatusLogService.save(new ApprovalUserAccountStatusLog()
|
||||||
|
|||||||
@ -263,17 +263,29 @@ public class UserAccountClientServiceImpl implements UserAccountClientService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateAccountFreeze(Long userId, Integer days) {
|
public boolean updateAccountFreeze(Long userId, Integer days) {
|
||||||
return baseInfoService.updateAccountFreeze(userId, days);
|
boolean updated = baseInfoService.updateAccountFreeze(userId, days);
|
||||||
|
if (updated) {
|
||||||
|
userProfileGateway.removeCacheAll(userId);
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateAccountStatus(Long userId, AccountStatusEnum accountStatus) {
|
public boolean updateAccountStatus(Long userId, AccountStatusEnum accountStatus) {
|
||||||
return baseInfoService.updateAccountStatus(userId, accountStatus);
|
boolean updated = baseInfoService.updateAccountStatus(userId, accountStatus);
|
||||||
|
if (updated) {
|
||||||
|
userProfileGateway.removeCacheAll(userId);
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateAccountStatusDays(Long userId, AccountStatusEnum accountStatus, Integer days) {
|
public boolean updateAccountStatusDays(Long userId, AccountStatusEnum accountStatus, Integer days) {
|
||||||
return baseInfoService.updateAccountStatusDays(userId, accountStatus, days);
|
boolean updated = baseInfoService.updateAccountStatusDays(userId, accountStatus, days);
|
||||||
|
if (updated) {
|
||||||
|
userProfileGateway.removeCacheAll(userId);
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -388,9 +400,12 @@ public class UserAccountClientServiceImpl implements UserAccountClientService {
|
|||||||
|
|
||||||
|
|
||||||
public UserAccountDTO createUserAccountDTO(Long userId, String imei, VoidConsumer voidConsumer) {
|
public UserAccountDTO createUserAccountDTO(Long userId, String imei, VoidConsumer voidConsumer) {
|
||||||
UserProfile userProfile = userProfileGateway.getByUserId(userId);
|
UserProfile userProfile = refreshStaleAccountStatus(userId,
|
||||||
userProfile.setFamilyId(Optional.ofNullable(familyMemberInfoService.getFamilyMemberByUserId(userId)).map(FamilyMemberInfo::getFamilyId).orElse(null));
|
userProfileGateway.getByUserId(userId));
|
||||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, userProfile);
|
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, userProfile);
|
||||||
|
userProfile.setFamilyId(Optional.ofNullable(familyMemberInfoService.getFamilyMemberByUserId(userId))
|
||||||
|
.map(FamilyMemberInfo::getFamilyId)
|
||||||
|
.orElse(null));
|
||||||
|
|
||||||
// 注册黑名单
|
// 注册黑名单
|
||||||
if (Objects.equals(userProfile.getDel(), Boolean.TRUE)) {
|
if (Objects.equals(userProfile.getDel(), Boolean.TRUE)) {
|
||||||
@ -431,6 +446,22 @@ public class UserAccountClientServiceImpl implements UserAccountClientService {
|
|||||||
return errorCode.getMessage() + "[ ID:" + userProfile.getAccount() + "]";
|
return errorCode.getMessage() + "[ ID:" + userProfile.getAccount() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private UserProfile refreshStaleAccountStatus(Long userId, UserProfile userProfile) {
|
||||||
|
if (Objects.isNull(userProfile) || userProfile.checkAccountAvailable()) {
|
||||||
|
return userProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseInfo baseInfo = baseInfoService.getById(userId);
|
||||||
|
if (Objects.isNull(baseInfo)
|
||||||
|
|| (Objects.equals(baseInfo.getAccountStatus(), userProfile.getAccountStatus())
|
||||||
|
&& Objects.equals(baseInfo.getFreezingTime(), userProfile.getFreezingTime()))) {
|
||||||
|
return userProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
userProfileGateway.removeCacheAll(userId);
|
||||||
|
return userProfileGateway.getByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
private void sendLoginMessage(AuthTypeEnum authTypeEnum, AppExtCommand cmd) {
|
private void sendLoginMessage(AuthTypeEnum authTypeEnum, AppExtCommand cmd) {
|
||||||
userMqMessageService.loginLogger(Objects.toString(cmd.requiredReqUserId()),
|
userMqMessageService.loginLogger(Objects.toString(cmd.requiredReqUserId()),
|
||||||
userProfileInnerConvertor.toLoginLoggerEventLogin(authTypeEnum, cmd));
|
userProfileInnerConvertor.toLoginLoggerEventLogin(authTypeEnum, cmd));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user