feat: (REQ-3057) 日志级别调整
This commit is contained in:
parent
83400137cb
commit
68011e8d1f
@ -31,6 +31,11 @@ public class ChatGroupChangeOwnerReq {
|
||||
@NotBlank(message = "新群主账号不能为空")
|
||||
private String newAccIdOwner;
|
||||
|
||||
/**
|
||||
* 1,群主身份转让后离开群;2,群主身份转让后成为普通成员
|
||||
*/
|
||||
private Integer leave;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
paramMap.put("icon", register.getIcon());
|
||||
paramMap.put("name", register.getName());
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("请求网易云信registerAccount,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_CREATE_URL,
|
||||
log.warn("请求网易云信registerAccount,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_CREATE_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(NIM_ACCOUNT_CREATE_URL).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
@ -179,7 +179,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(register.getAccid());
|
||||
queryParamMap.put("accids", jsonArray.toString());
|
||||
log.info("请求网易云信getUserInfo,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_QUERY_URL,
|
||||
log.warn("请求网易云信getUserInfo,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_QUERY_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(queryParamMap));
|
||||
HttpResponse queryAccountResponse = HttpRequest.post(NIM_ACCOUNT_QUERY_URL).addHeaders(authHeaderMap)
|
||||
.form(queryParamMap).timeout(5000).execute();
|
||||
@ -243,7 +243,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
boolean hasError = response.getStatus() != SUCCESS_CODE
|
||||
|| (nimResp != null && nimResp.getCode() != SUCCESS_CODE);
|
||||
if (hasError || props.isLogSuccessNimRequest()) {
|
||||
log.info("请求网易云信dispatchMessage,URL:{},Header:{},请求参数:{}, 响应: {}, {}", NIM_MESSAGE_DISPATCH_URL,
|
||||
log.warn("请求网易云信dispatchMessage,URL:{},Header:{},请求参数:{}, 响应: {}, {}", NIM_MESSAGE_DISPATCH_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap), response.body(),
|
||||
hasError ? "NIM请求异常" : "NIM请求正常");
|
||||
}
|
||||
@ -285,13 +285,13 @@ public class NimChannelService implements IMChannelProvider {
|
||||
}
|
||||
} finally {
|
||||
if (response == null) {
|
||||
log.info("请求网易云信dispatchBatchMessage,URL:{},Header:{},请求参数:{}, response=null", NIM_MESSAGE_BATCH_DISPATCH_URL,
|
||||
log.warn("请求网易云信dispatchBatchMessage,URL:{},Header:{},请求参数:{}, response=null", NIM_MESSAGE_BATCH_DISPATCH_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
} else {
|
||||
boolean hasError = response.getStatus() != SUCCESS_CODE
|
||||
|| (nimResp != null && nimResp.getCode() != SUCCESS_CODE);
|
||||
if (hasError || props.isLogSuccessNimRequest()) {
|
||||
log.info("请求网易云信dispatchBatchMessage,URL:{},Header:{},请求参数:{}, 响应: {}, {}", NIM_MESSAGE_BATCH_DISPATCH_URL,
|
||||
log.warn("请求网易云信dispatchBatchMessage,URL:{},Header:{},请求参数:{}, 响应: {}, {}", NIM_MESSAGE_BATCH_DISPATCH_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap), response.body(),
|
||||
hasError ? "NIM请求异常" : "NIM请求正常");
|
||||
}
|
||||
@ -315,11 +315,11 @@ public class NimChannelService implements IMChannelProvider {
|
||||
paramMap.put("isForcePush", ObjectUtil.defaultIfNull(param.getIsForcePush(), false));
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("dispatchCustomMessage request,URL: {}, Header:{}, param:{}", NIM_MESSAGE_ATTACH_URL,
|
||||
log.warn("dispatchCustomMessage request,URL: {}, Header:{}, param:{}", NIM_MESSAGE_ATTACH_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(NIM_MESSAGE_ATTACH_URL).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
log.info("dispatchCustomMessage resp,URL:{} , Header:{}, response:{}", NIM_MESSAGE_ATTACH_URL,
|
||||
log.warn("dispatchCustomMessage resp,URL:{} , Header:{}, response:{}", NIM_MESSAGE_ATTACH_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), response.body());
|
||||
if (response.getStatus() == SUCCESS_CODE) {
|
||||
MessageCustomDispatchResponse registerResponse = JSONUtil.toBean(response.body(),
|
||||
@ -349,7 +349,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
}
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
if (props.isLogSuccessNimRequest()) {
|
||||
log.info("请求网易云信updateProfile,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_UPDATE_URL,
|
||||
log.warn("请求网易云信updateProfile,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_UPDATE_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
}
|
||||
HttpResponse response = HttpRequest.post(NIM_ACCOUNT_UPDATE_URL).addHeaders(authHeaderMap)
|
||||
@ -392,12 +392,12 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildChatGroupCreate(request);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("chatGroupCreate-请求网易云信,URL:{},Header:{},请求参数:{}", CHAT_GROUP_CREATE,
|
||||
log.warn("chatGroupCreate-请求网易云信,URL:{},Header:{},请求参数:{}", CHAT_GROUP_CREATE,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(CHAT_GROUP_CREATE).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("chatGroupCreate-请求网易云信,result:{}", result);
|
||||
log.warn("chatGroupCreate-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.error("chatGroupCreate-请求网易云信Server:{},异常:{}", CHAT_GROUP_CREATE, result);
|
||||
ChatGroupCreateResponse chatGroupCreateResponse = JSONUtil.toBean(result, ChatGroupCreateResponse.class);
|
||||
@ -449,18 +449,19 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildUserAddChatGroup(request);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("userAddChatGroup-请求网易云信,URL:{},Header:{},请求参数:{}", USER_ADD_CHAT_GROUP,
|
||||
log.warn("userAddChatGroup-请求网易云信,URL:{},Header:{},请求参数:{}", USER_ADD_CHAT_GROUP,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(USER_ADD_CHAT_GROUP).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("userAddChatGroup-请求网易云信,result:{}", result);
|
||||
log.warn("userAddChatGroup-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.error("userAddChatGroup-请求网易云信Server:{},异常:{}", CHAT_GROUP_CREATE, result);
|
||||
throw new ServiceException("userAddChatGroup-请求网易云信Server异常,result:" + result);
|
||||
}
|
||||
UserAddChatGroupResponse userAddChatGroupResponse = JSONUtil.toBean(result, UserAddChatGroupResponse.class);
|
||||
if (userAddChatGroupResponse == null) {
|
||||
log.warn("userAddChatGroup-请求网易云信Server异常userAddChatGroupResponse is null,result:{}", result);
|
||||
throw new ServiceException("userAddChatGroup-请求网易云信Server异常[" + result + "],请联系管理员!");
|
||||
}
|
||||
if (userAddChatGroupResponse.getCode() != SUCCESS_CODE) {
|
||||
@ -480,12 +481,12 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildKickChatGroup(request);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("kickChatGroup-请求网易云信,URL:{},Header:{},请求参数:{}", KICK_CHAT_GROUP,
|
||||
log.warn("kickChatGroup-请求网易云信,URL:{},Header:{},请求参数:{}", KICK_CHAT_GROUP,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(KICK_CHAT_GROUP).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("kickChatGroup-请求网易云信,result:{}", result);
|
||||
log.warn("kickChatGroup-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.error("kickChatGroup-请求网易云信Server:{},异常:{}", KICK_CHAT_GROUP, result);
|
||||
throw new ServiceException("kickChatGroup-请求网易云信Server:" + KICK_CHAT_GROUP +",异常:" + result);
|
||||
@ -493,6 +494,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
|
||||
UserAddChatGroupResponse kickChatGroupResponse = JSONUtil.toBean(result, UserAddChatGroupResponse.class);
|
||||
if (kickChatGroupResponse == null) {
|
||||
log.warn("kickChatGroup-请求网易云信Server kickChatGroupResponse is null:{},返回异常:{}", KICK_CHAT_GROUP, result);
|
||||
throw new ServiceException("kickChatGroup-请求网易云信Server异常[" + result + "],请联系管理员!");
|
||||
}
|
||||
if (kickChatGroupResponse.getCode() != SUCCESS_CODE) {
|
||||
@ -535,12 +537,12 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildChatGroupQuery(tids, ope);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("chatGroupQuery-请求网易云信,URL:{},Header:{},请求参数:{}", CHAT_GROUP_QUERY,
|
||||
log.warn("chatGroupQuery-请求网易云信,URL:{},Header:{},请求参数:{}", CHAT_GROUP_QUERY,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(CHAT_GROUP_QUERY).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("chatGroupQuery-请求网易云信,result:{}", result);
|
||||
log.warn("chatGroupQuery-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.error("chatGroupQuery-请求网易云信Server:{},异常:{}", CHAT_GROUP_QUERY, result);
|
||||
return ChatGroupQueryResponse.builder().desc("chatGroupQuery-请求网易云信Server异常,请联系管理员!").build();
|
||||
@ -548,6 +550,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
|
||||
ChatGroupQueryResponse chatGroupQueryResponse = JSONUtil.toBean(result, ChatGroupQueryResponse.class);
|
||||
if (chatGroupQueryResponse == null) {
|
||||
log.warn("chatGroupQuery-请求网易云信异常chatGroupQueryResponse is null,{},result:{}",CHAT_GROUP_QUERY, result);
|
||||
return ChatGroupQueryResponse.builder().desc("chatGroupQuery-请求网易云信Server异常[" + result + "],请联系管理员!").build();
|
||||
}
|
||||
if (chatGroupQueryResponse.getCode() != SUCCESS_CODE) {
|
||||
@ -574,19 +577,19 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildChangeOwner(request);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("changeOwner-请求网易云信,URL:{},Header:{},请求参数:{}", CHANGE_OWNER,
|
||||
log.warn("changeOwner-请求网易云信,URL:{},Header:{},请求参数:{}", CHANGE_OWNER,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(CHANGE_OWNER).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("changeOwner-请求网易云信,result:{}", result);
|
||||
log.warn("changeOwner-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.error("changeOwner-请求网易云信Server:{},异常:{}", CHANGE_OWNER, result);
|
||||
throw new ServiceException("changeOwner-请求网易云信Server:" + KICK_CHAT_GROUP +",异常:" + result);
|
||||
}
|
||||
ChangeOwnerResponse changeOwnerResponse = JSONUtil.toBean(result, ChangeOwnerResponse.class);
|
||||
if (changeOwnerResponse == null) {
|
||||
log.error("changeOwner-请求网易云信Server:{},异常:{}", CHANGE_OWNER, result);
|
||||
log.error("changeOwner-请求网易云信Server,changeOwnerResponse is null:{},异常:{}", CHANGE_OWNER, result);
|
||||
throw new ServiceException("changeOwner-请求网易云信Server:" + KICK_CHAT_GROUP +",异常:" + result);
|
||||
}
|
||||
if (changeOwnerResponse.getCode() != SUCCESS_CODE) {
|
||||
@ -617,12 +620,12 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildJoinTeam(accid);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("joinTeam-请求网易云信,URL:{},Header:{},请求参数:{}", JOIN_TEAM,
|
||||
log.warn("joinTeam-请求网易云信,URL:{},Header:{},请求参数:{}", JOIN_TEAM,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(JOIN_TEAM).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("joinTeam-请求网易云信,result:{}", result);
|
||||
log.warn("joinTeam-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.warn("joinTeam-请求网易云信Server:{},异常:{}", JOIN_TEAM, result);
|
||||
}
|
||||
@ -649,7 +652,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HttpResponse response = HttpRequest.post(PRIVATE_HISTORY_MSG_QUERY).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("privateHistoryMsgQuery-请求网易云信,result:{}", result);
|
||||
log.warn("privateHistoryMsgQuery-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.warn("privateHistoryMsgQuery-请求网易云信Server:{},异常:{}", PRIVATE_HISTORY_MSG_QUERY, result);
|
||||
}
|
||||
@ -688,12 +691,12 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildGroupHistoryMsgQuery(req);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("groupHistoryMsgQuery-请求网易云信,URL:{},Header:{},请求参数:{}", GROUP_HISTORY_MSG_QUERY,
|
||||
log.warn("groupHistoryMsgQuery-请求网易云信,URL:{},Header:{},请求参数:{}", GROUP_HISTORY_MSG_QUERY,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(GROUP_HISTORY_MSG_QUERY).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
String result = response.body();
|
||||
log.info("groupHistoryMsgQuery-请求网易云信,result:{}", result);
|
||||
log.warn("groupHistoryMsgQuery-请求网易云信,result:{}", result);
|
||||
if (response.getStatus() != SUCCESS_CODE) {
|
||||
log.warn("groupHistoryMsgQuery-请求网易云信Server:{},异常:{}", GROUP_HISTORY_MSG_QUERY, result);
|
||||
}
|
||||
@ -715,7 +718,7 @@ public class NimChannelService implements IMChannelProvider {
|
||||
HashMap<String, Object> paramMap = this.buildGetUinfos(accids, muteStatus);
|
||||
|
||||
Map<String, String> authHeaderMap = buildAuthHeader(getProviderAppKey(), getProviderAppSecret());
|
||||
log.info("getUinfos-请求网易云信,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_QUERY_URL,
|
||||
log.warn("getUinfos-请求网易云信,URL:{},Header:{},请求参数:{}", NIM_ACCOUNT_QUERY_URL,
|
||||
JSONUtil.toJsonStr(authHeaderMap), JSONUtil.toJsonStr(paramMap));
|
||||
HttpResponse response = HttpRequest.post(NIM_ACCOUNT_QUERY_URL).addHeaders(authHeaderMap)
|
||||
.form(paramMap).timeout(5000).execute();
|
||||
|
||||
@ -28,6 +28,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -133,7 +134,8 @@ public class ChatGroupChangeOwnerEventHandler implements EventHandler, Initializ
|
||||
}
|
||||
// 2 用户添加进群/更换群主
|
||||
this.chatGroupService.userAddChatGroup(UserAddChatGroupReq.builder().chatGroupId(chatGroup.getId()).members(Sets.newHashSet(newImAccountOwner)).build(), ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), newImAccountOwner, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
Set<String> members = this.chatGroupService.chatGroupOfMembers(chatGroup.getCrowType(), chatGroup.getWorkspaceId(), chatGroup.getOuId(), chatGroup.getCreator());
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), newImAccountOwner,members.contains(chatGroup.getGroupOwner()) ? 2 : 1, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
break;
|
||||
case OU:
|
||||
if (!checkChangeOwnerWhenOu(newValues, chatGroup.getGroupOwner(), newImAccountOwner, userRelation.getOuId(), chatGroup.getOuId())) {
|
||||
@ -142,7 +144,9 @@ public class ChatGroupChangeOwnerEventHandler implements EventHandler, Initializ
|
||||
}
|
||||
// 2 用户添加进群/更换群主
|
||||
this.chatGroupService.userAddChatGroup(UserAddChatGroupReq.builder().chatGroupId(chatGroup.getId()).members(Sets.newHashSet(newImAccountOwner)).build(),ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), newImAccountOwner, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
|
||||
Set<String> membersWhenOu = this.chatGroupService.chatGroupOfMembers(chatGroup.getCrowType(), chatGroup.getWorkspaceId(), chatGroup.getOuId(), chatGroup.getCreator());
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), newImAccountOwner, membersWhenOu.contains(chatGroup.getGroupOwner()) ? 2 : 1, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
break;
|
||||
case TEAM:
|
||||
break;
|
||||
|
||||
@ -60,7 +60,7 @@ public class ChatGroupEventHandler implements EventHandler, InitializingBean {
|
||||
long start = System.currentTimeMillis();
|
||||
handleMqMessage(event);
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("ChatGroupEventHandlerend-handle mq event, used={}ms, event={}", end - start, JSON.toJSONString(event));
|
||||
log.warn("ChatGroupEventHandlerend-handle mq event, used={}ms, event={}", end - start, JSON.toJSONString(event));
|
||||
} catch (Exception e) {
|
||||
log.warn("ChatGroupEventHandler-error - handle mq event, event={}", JSON.toJSONString(event), e);
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author xudawei@axzo.cn
|
||||
@ -196,7 +197,8 @@ public class OrganizationalNodeUserChangeEventHandler implements EventHandler, I
|
||||
log.info("班组长并未变更,不执行更改群主逻辑,currentImAccount:{},chatGroupId:{}", currentImAccount, chatGroup.getId());
|
||||
return;
|
||||
}
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), currentImAccount, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
Set<String> members = this.chatGroupService.chatGroupOfMembers(chatGroup.getCrowType(), chatGroup.getWorkspaceId(), chatGroup.getOuId(), chatGroup.getCreator());
|
||||
this.chatGroupService.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), currentImAccount, members.contains(chatGroup.getGroupOwner()) ? 2 : 1, ChatGroupUserDataSourceEnum.USER_CHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -100,7 +100,7 @@ public interface ChatGroupService extends IService<ChatGroup> {
|
||||
* @param oldAccIdOwner 原群主账号
|
||||
* @param newAccIdOwner 新群主账号
|
||||
*/
|
||||
void changeOwner(Long chatGroupId, String oldAccIdOwner, String newAccIdOwner, ChatGroupUserDataSourceEnum dataSource);
|
||||
void changeOwner(Long chatGroupId, String oldAccIdOwner, String newAccIdOwner, Integer leave, ChatGroupUserDataSourceEnum dataSource);
|
||||
|
||||
/**
|
||||
* 更改群主
|
||||
@ -138,4 +138,9 @@ public interface ChatGroupService extends IService<ChatGroup> {
|
||||
*/
|
||||
ChatGroupGetUinfosResp getUinfos(ChatGroupGetUinfosReq req);
|
||||
|
||||
/**
|
||||
* 构建群成员信息
|
||||
*/
|
||||
Set<String> chatGroupOfMembers(ChatGroupCreateReq.CrowTypeEnum crowType, Long workspaceId, Long ouId, Long creator);
|
||||
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
@Override
|
||||
public void changeOwner(ChatGroupChangeOwnerReq req) {
|
||||
ChatGroup chatGroup = this.getById(req.getChatGroupId());
|
||||
this.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), req.getNewAccIdOwner(), ChatGroupUserDataSourceEnum.API_HANDLE);
|
||||
this.changeOwner(chatGroup.getId(), chatGroup.getGroupOwner(), req.getNewAccIdOwner(),req.getLeave(), ChatGroupUserDataSourceEnum.API_HANDLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,7 +480,7 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
* @param newAccIdOwner 新群主账号
|
||||
*/
|
||||
@Override
|
||||
public void changeOwner(Long chatGroupId, String oldAccIdOwner, String newAccIdOwner, ChatGroupUserDataSourceEnum dataSource) {
|
||||
public void changeOwner(Long chatGroupId, String oldAccIdOwner, String newAccIdOwner, Integer leave, ChatGroupUserDataSourceEnum dataSource) {
|
||||
//新老账号群主相同,则进行更换群主
|
||||
if (Objects.equals(oldAccIdOwner, newAccIdOwner)) {
|
||||
return;
|
||||
@ -492,7 +492,7 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
changeOwnerRequest.setTid(chatGroup.getTid());
|
||||
changeOwnerRequest.setOwner(oldAccIdOwner);
|
||||
changeOwnerRequest.setNewowner(newAccIdOwner);
|
||||
changeOwnerRequest.setLeave(1);
|
||||
changeOwnerRequest.setLeave(leave);
|
||||
|
||||
nimChannelService.changeOwner(changeOwnerRequest);
|
||||
this.updateGroupOwner(chatGroupId, newAccIdOwner);
|
||||
@ -682,6 +682,31 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
// DingTalkUtil.sendMessage("【环境:" + env + "】\n" + content, chatGroupConfig.getDingTalkBotAccessToken(), chatGroupConfig.getDingTalkBotSecret());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建群成员信息
|
||||
*/
|
||||
public Set<String> chatGroupOfMembers(ChatGroupCreateReq.CrowTypeEnum crowType, Long workspaceId, Long ouId, Long creator) {
|
||||
//Pair,key:管理人员集合;value:工人集合
|
||||
Pair<List<OrganizationalNodeUserVO>, List<OrganizationalNodeUserVO>> adminWorkerPair = this.fetchUsersByWorkspaceOuId(crowType, workspaceId, ouId, this.buildJobCodesByCrowType(crowType), creator);
|
||||
List<OrganizationalNodeUserVO> adminSet = adminWorkerPair.getKey();
|
||||
List<OrganizationalNodeUserVO> workerSet = adminWorkerPair.getValue();
|
||||
|
||||
Set<String> userAccountRespList = Sets.newHashSet();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(adminSet)) {
|
||||
for (OrganizationalNodeUserVO item : adminSet) {
|
||||
userAccountRespList.add(this.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), item.getPersonId(), item.getOrganizationalUnitId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(workerSet)) {
|
||||
for (OrganizationalNodeUserVO worker : workerSet) {
|
||||
userAccountRespList.add(this.registerAccountIfAbsent(AppTypeEnum.CM.getCode(), worker.getPersonId(), worker.getOrganizationalUnitId()));
|
||||
}
|
||||
}
|
||||
return userAccountRespList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
Loading…
Reference in New Issue
Block a user