1,解决删除用户保留信息时错误问题;2,server api获取用户信息时,可以指定获取包含被删除用户。

This commit is contained in:
heavyrian2012
2026-02-03 19:51:03 +08:00
parent 52b624f25e
commit 8322134e18
5 changed files with 35 additions and 4 deletions
@@ -35,6 +35,9 @@ public class ThreadPoolExecutorWrapper {
executor.execute(() -> { executor.execute(() -> {
try { try {
task.run(); task.run();
} catch (Exception e) {
e.printStackTrace();
LOG.info("execute error = {}", e.toString());
} finally { } finally {
int endCount = runCounter.decrementAndGet(); int endCount = runCounter.decrementAndGet();
LOG.debug("Finish task and current task count {} use time {}", endCount, System.currentTimeMillis()-startTime); LOG.debug("Finish task and current task count {} use time {}", endCount, System.currentTimeMillis()-startTime);
@@ -49,7 +49,7 @@ public class GetUserAction extends AdminAction {
} }
RestResult result; RestResult result;
if (user == null || user.getDeleted() > 0) { if (user == null || (user.getDeleted() > 0 && !inputUserId.isIncludeDeleted())) {
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
} else { } else {
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user)); result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
@@ -3176,7 +3176,7 @@ public class MemoryMessagesStore implements IMessagesStore {
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS); IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
WFCMessage.User us = mUserMap.get(userId); WFCMessage.User us = mUserMap.get(userId);
if (us != null) { if (us != null) {
WFCMessage.User.Builder builder = WFCMessage.User.newBuilder().setUpdateDt(System.currentTimeMillis()).setDeleted(1); WFCMessage.User.Builder builder = us.toBuilder().setUpdateDt(System.currentTimeMillis()).setDeleted(1);
if(keepFullInfoWhenDestroyUser) { if(keepFullInfoWhenDestroyUser) {
if(!keepMobileWhenDestroyUser) { if(!keepMobileWhenDestroyUser) {
@@ -12,6 +12,7 @@ public class InputGetUserInfo {
private String userId; private String userId;
private String name; private String name;
private String mobile; private String mobile;
private boolean includeDeleted;
public InputGetUserInfo() { public InputGetUserInfo() {
} }
@@ -22,6 +23,13 @@ public class InputGetUserInfo {
this.mobile = mobile; this.mobile = mobile;
} }
public InputGetUserInfo(String userId, String name, String mobile, boolean includeDeleted) {
this.userId = userId;
this.name = name;
this.mobile = mobile;
this.includeDeleted = includeDeleted;
}
public String getMobile() { public String getMobile() {
return mobile; return mobile;
} }
@@ -45,4 +53,12 @@ public class InputGetUserInfo {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public boolean isIncludeDeleted() {
return includeDeleted;
}
public void setIncludeDeleted(boolean includeDeleted) {
this.includeDeleted = includeDeleted;
}
} }
@@ -9,18 +9,30 @@ import java.util.List;
public class UserAdmin { public class UserAdmin {
public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception { public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception {
return getUserByName(name, false);
}
public static IMResult<InputOutputUserInfo> getUserByName(String name, boolean includeDeleted) throws Exception {
String path = APIPath.User_Get_Info; String path = APIPath.User_Get_Info;
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, name, null); InputGetUserInfo getUserInfo = new InputGetUserInfo(null, name, null, includeDeleted);
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
} }
public static IMResult<InputOutputUserInfo> getUserByUserId(String userId) throws Exception { public static IMResult<InputOutputUserInfo> getUserByUserId(String userId) throws Exception {
return getUserByUserId(userId, false);
}
public static IMResult<InputOutputUserInfo> getUserByUserId(String userId, boolean includeDeleted) throws Exception {
String path = APIPath.User_Get_Info; String path = APIPath.User_Get_Info;
InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null); InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null, includeDeleted);
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
} }
public static IMResult<InputOutputUserInfo> getUserByMobile(String mobile) throws Exception { public static IMResult<InputOutputUserInfo> getUserByMobile(String mobile) throws Exception {
return getUserByMobile(mobile, false);
}
public static IMResult<InputOutputUserInfo> getUserByMobile(String mobile, boolean includeDeleted) throws Exception {
String path = APIPath.User_Get_Info; String path = APIPath.User_Get_Info;
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, mobile); InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, mobile);
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);