feat: (REQ-3057) 人群类型title与desc优化/同步IM账号昵称与头像
This commit is contained in:
parent
e970fd92e2
commit
f0db56f77f
@ -32,4 +32,14 @@ public class AccountAbsentQuery {
|
||||
*/
|
||||
private Long ouId;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像链接
|
||||
*/
|
||||
private String headImageUrl;
|
||||
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ public class ChatGroupCreateReq implements Serializable {
|
||||
@Getter
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public enum CrowTypeEnum {
|
||||
WORKSPACE("workspace", "项目","项目管理人员","除去班组长及工人,包含项目经理、施工员、财务、安全员、安全员、安全员.......",1),
|
||||
OU("ou", "单位" ,"本单位项目管理人员", "本单位项目的管理人员,除去班组长及工人,包含项目经理、施工员、财务、安全员、安全员、安全员.......",2),
|
||||
WORKSPACE("workspace", "项目","项目管理人员","除去班组长及工人,包含项目经理、施工员、财务、安全员.......",1),
|
||||
OU("ou", "单位" ,"本单位项目管理人员", "本单位项目的管理人员,除去班组长及工人,包含项目经理、施工员、财务、安全员.......",2),
|
||||
TEAM("team", "班组", "项目班组群", "本项目内的班组长、带班长、工人",3),
|
||||
;
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ public class ChatGroupChangeOwnerEventHandler implements EventHandler, Initializ
|
||||
* 执行更换群主
|
||||
*/
|
||||
private void doChangeOwner(SaasRoleUserRelation userRelation, List<SaasRoleUserRelation> newValues) {
|
||||
String newImAccountOwner = this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), userRelation.getNaturalPersonId().toString(), userRelation.getOuId());
|
||||
String newImAccountOwner = this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), userRelation.getNaturalPersonId(), userRelation.getOuId());
|
||||
|
||||
//1 用户是群主的群聊集合
|
||||
ChatGroupGenericSearchReq req = new ChatGroupGenericSearchReq();
|
||||
|
||||
@ -100,7 +100,7 @@ public class ChatGroupEventHandler implements EventHandler, InitializingBean {
|
||||
log.info("admin-personProfileDto is null");
|
||||
continue;
|
||||
}
|
||||
userAccountRespList.add(this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), item.getPersonId().toString(), item.getOrganizationalUnitId()));
|
||||
userAccountRespList.add(this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), item.getPersonId(), item.getOrganizationalUnitId()));
|
||||
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public class ChatGroupEventHandler implements EventHandler, InitializingBean {
|
||||
log.info("worker-personProfileDto is null");
|
||||
continue;
|
||||
}
|
||||
userAccountRespList.add(this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CM.getCode(), worker.getPersonId().toString(), worker.getOrganizationalUnitId()));
|
||||
userAccountRespList.add(this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CM.getCode(), worker.getPersonId(), worker.getOrganizationalUnitId()));
|
||||
}
|
||||
return userAccountRespList;
|
||||
}
|
||||
|
||||
@ -248,12 +248,12 @@ public class OrganizationalNodeUserChangeEventHandler implements EventHandler, I
|
||||
switch (crowTypeEnum) {
|
||||
case WORKSPACE:
|
||||
case OU:
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), personId.toString(), ouId);
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), personId, ouId);
|
||||
case TEAM:
|
||||
if (jobCode.equals("projTeamLeader") || jobCode.equals("projectTeamManager")) {
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), personId.toString(), ouId);
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), personId, ouId);
|
||||
}
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CM.getCode(), personId.toString(), ouId);
|
||||
return this.chatGroupService.registerAccountIfAbsent(AppTypeEnum.CM.getCode(), personId, ouId);
|
||||
default:
|
||||
BizAssertions.assertTrue(false, "人群类型不匹配");
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ public class AccountService {
|
||||
AccountTypeEnum.USER.getCode(), userAccountReq.getHeadImageUrl(), userAccountReq.getNickName(), userAccountReq.getOrganizationalUnitId());
|
||||
|
||||
if (iNotifyService != null && userAccountResp != null && StringUtils.isNotBlank(userAccountResp.getImAccount())) {
|
||||
iNotifyService.notifyUserAccountChange(userAccountResp.getImAccount(), userAccountReq.getNickName(), null);
|
||||
iNotifyService.notifyUserAccountChange(userAccountResp.getImAccount(), userAccountReq.getNickName(), userAccountReq.getHeadImageUrl());
|
||||
}
|
||||
return userAccountResp;
|
||||
}
|
||||
@ -411,7 +411,9 @@ public class AccountService {
|
||||
UserAccountReq userAccountReq = new UserAccountReq();
|
||||
userAccountReq.setAppType(appTypeEnum.getCode());
|
||||
userAccountReq.setUserId(accountAbsentQuery.getPersonId());
|
||||
userAccountReq.setNickName(DEFAULT_NICK_NAME + accountAbsentQuery.getPersonId());
|
||||
|
||||
userAccountReq.setNickName(StringUtils.isNotBlank(accountAbsentQuery.getNickName())? accountAbsentQuery.getNickName() : DEFAULT_NICK_NAME + accountAbsentQuery.getPersonId());
|
||||
userAccountReq.setHeadImageUrl(accountAbsentQuery.getHeadImageUrl());
|
||||
// 管理版需要根据ou注册IM账号,做数据隔离
|
||||
if (appTypeEnum == AppTypeEnum.CMP && accountAbsentQuery.getOuId() != null && accountAbsentQuery.getOuId() != 0) {
|
||||
userAccountReq.setOrganizationalUnitId(accountAbsentQuery.getOuId());
|
||||
|
||||
@ -131,7 +131,7 @@ public interface ChatGroupService extends IService<ChatGroup> {
|
||||
/**
|
||||
* 注册IM账号(支持幂等性)
|
||||
*/
|
||||
String registerAccountIfAbsent(String appType, String personId, Long ouId);
|
||||
String registerAccountIfAbsent(String appType, Long personId, Long ouId);
|
||||
|
||||
/**
|
||||
* 用户卡片
|
||||
|
||||
@ -343,7 +343,7 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
PersonProfileDto owner = profilesApiGateway.getPersonProfileById(ownerId);
|
||||
BizAssertions.assertFalse(Objects.isNull(owner) || Objects.isNull(owner.getId()), "超管用户不存在");
|
||||
|
||||
String imAccount = this.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), owner.getId().toString(), ouId);
|
||||
String imAccount = this.registerAccountIfAbsent(AppTypeEnum.CMP.getCode(), owner.getId(), ouId);
|
||||
|
||||
resp.setOwnerId(owner.getId());
|
||||
resp.setOwnerImAccount(imAccount);
|
||||
@ -638,11 +638,15 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
|
||||
* 注册IM账号(支持幂等性)
|
||||
*/
|
||||
@Override
|
||||
public String registerAccountIfAbsent(String appType, String personId, Long ouId) {
|
||||
public String registerAccountIfAbsent(String appType, Long personId, Long ouId) {
|
||||
AccountAbsentQuery query = new AccountAbsentQuery();
|
||||
query.setAppType(appType);
|
||||
query.setPersonId(personId);
|
||||
query.setPersonId(personId.toString());
|
||||
query.setOuId(ouId);
|
||||
PersonProfileDto personProfileDto = profilesApiGateway.getPersonProfileById(personId);
|
||||
query.setNickName(personProfileDto.getRealName());
|
||||
query.setHeadImageUrl(personProfileDto.getAvatarUrl());
|
||||
|
||||
List<UserAccountResp> userAccountResps = accountService.registerAccountIfAbsent(query);
|
||||
if (CollectionUtils.isEmpty(userAccountResps)) {
|
||||
this.sendDingRobot(String.format("创建IM账号失败,appType:%s,personId:%s,ouId:%d", appType, personId, ouId));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user