1. 增加actualAccount 邀请处理增加校验
2. 消息extParam去除i8n
3. 邀请代理和邀请主播-参数处理
This commit is contained in:
tianfeng 2025-10-16 12:08:47 +08:00
parent 0c587a4cb2
commit dc3ab5b923
6 changed files with 50 additions and 62 deletions

View File

@ -1,5 +1,6 @@
package com.red.circle.external.infra.common;
import com.alibaba.fastjson.JSON;
import com.red.circle.component.instant.msg.tencet.notice.official.NoticeExtParam;
import com.red.circle.component.instant.msg.tencet.service.endpoint.api.im.account.ImMessageManagerService;
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateAbstract;
@ -161,8 +162,8 @@ public class OfficialNoticeCommonService {
: noticeTypeEnum.getTitle(locale);
String content = Objects.nonNull(typeCmd.getTemplateParam())
? noticeTypeEnum.getBodyFormat(locale, typeCmd.getTemplateParam())
: noticeTypeEnum.getBody(locale);
? JSON.toJSONString(typeCmd.getTemplateParam())
: "";
return NoticeExtParam.builder()
.id(getId(cmd))

View File

@ -72,8 +72,9 @@ public class AgentInviteHostExe {
bdInviteAgentMessageService.existsWaitMessage(cmd.requiredReqUserId(),
cmd.getInviteUserId(), MessageInviteGroup.AGENT_INVITE_HOST.name()));
String messageId = IdWorkerUtils.getIdStr();
bdInviteAgentMessageService.add(new BdInviteAgentMessage()
.setId(IdWorkerUtils.getIdStr())
.setId(messageId)
.setSysOrigin(cmd.requireReqSysOrigin())
.setUserId(cmd.requiredReqUserId())
.setInviteUserId(cmd.getInviteUserId())
@ -85,7 +86,16 @@ public class AgentInviteHostExe {
.setExpiredTime(TimestampUtils.nowPlusDays(2))
);
sendMessage(cmd);
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId()));
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfileDTO);
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.AGENT_SEND_INVITE_HOST)
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfileDTO))
.expand(messageId)
.build()
);
}
public List<BdInviteMessageCO> messageCOList(BdInviteQryCmd cmd) {
@ -131,6 +141,7 @@ public class AgentInviteHostExe {
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR, cmd.getStatus() > 0);
BdInviteAgentMessage message = bdInviteAgentMessageService.getById(cmd.getId());
ResponseAssert.isTrue(CommonErrorCode.OPERATING_FAILURE, message.getStatus() == 0);
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, message);
ResponseAssert.isTrue(CommonErrorCode.NOT_FOUND_RECORD_INFO,
@ -189,19 +200,4 @@ public class AgentInviteHostExe {
.build()
);
}
private void sendMessage(AgentInviteHostCmd cmd) {
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId()));
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile);
// String h5Url = enumConfigCacheService.getValue(EnumConfigKey.H5_DOMAIN_BASE_URL_V2,cmd.requireReqSysOrigin());
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.AGENT_SEND_INVITE_HOST)
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
// .expand(h5Url)
.build()
);
}
}

View File

@ -88,8 +88,9 @@ public class BdAgentInviteExe {
// 校验邀请人与被邀请人的区域
checkInvite(cmd);
String messageId = IdWorkerUtils.getIdStr();
bdInviteAgentMessageService.add(new BdInviteAgentMessage()
.setId(IdWorkerUtils.getIdStr())
.setId(messageId)
.setSysOrigin(cmd.requireReqSysOrigin())
.setUserId(cmd.requiredReqUserId())
.setInviteUserId(cmd.getInviteUserId())
@ -101,7 +102,18 @@ public class BdAgentInviteExe {
.setExpiredTime(TimestampUtils.nowPlusDays(2))
);
sendMessage(cmd);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.requiredReqUserId())
);
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile);
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.BD_SEND_INVITE_AGENT)
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
.expand(messageId)
.build()
);
}
public void cancel(String id) {
@ -153,17 +165,4 @@ public class BdAgentInviteExe {
return CollectionUtils.isEmpty(teamMemberService.listMemberIds(userIds));
}
private void sendMessage(DbInviteAgentCmd cmd) {
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.requiredReqUserId())
);
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile);
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.BD_SEND_INVITE_AGENT)
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
.build()
);
}
}

View File

@ -9,6 +9,7 @@ import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.framework.core.response.ResponseErrorCode;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.cmd.team.DbInviteMessageProcessCmd;
import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMessage;
import com.red.circle.other.infra.database.mongo.entity.team.bd.MessageInviteGroup;
@ -72,6 +73,7 @@ public class BdInviteMessageProcessExe {
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR, cmd.getStatus() > 0);
BdInviteAgentMessage message = bdInviteAgentMessageService.getById(cmd.getId());
ResponseAssert.isTrue(CommonErrorCode.OPERATING_FAILURE, message.getStatus() == 0);
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, message);
ResponseAssert.isTrue(CommonErrorCode.NOT_FOUND_RECORD_INFO,
@ -193,10 +195,7 @@ public class BdInviteMessageProcessExe {
officialNoticeClient.send(
NoticeExtTemplateTypeCmd.builder()
.toAccount(message.getUserId())
.templateParam(MapBuilder.builder()
.put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(),
userProfile.actualAccount()))
.build())
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
.noticeType(noticeTypeEnum)
.build()
);

View File

@ -8,6 +8,7 @@ import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.cmd.team.DbLeaderInviteBdCmd;
import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMessage;
@ -68,8 +69,9 @@ public class BdLeaderInviteBdExe {
bdInviteAgentMessageService.existsWaitMessage(cmd.requiredReqUserId(),
cmd.getInviteUserId(), MessageInviteGroup.BD_LEADER_INVITE_BD.name()));
String messageId = IdWorkerUtils.getIdStr();
bdInviteAgentMessageService.add(new BdInviteAgentMessage()
.setId(IdWorkerUtils.getIdStr())
.setId(messageId)
.setSysOrigin(cmd.requireReqSysOrigin())
.setUserId(cmd.requiredReqUserId())
.setInviteUserId(cmd.getInviteUserId())
@ -81,7 +83,18 @@ public class BdLeaderInviteBdExe {
.setExpiredTime(TimestampUtils.nowPlusDays(2))
);
sendMessage(cmd);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.requiredReqUserId())
);
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.BD_LEADER_SEND_INVITE_BD)
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
.expand(messageId)
.build()
);
}
private BusinessDevelopmentBaseInfo getDevelopmentBaseInfoServiceByUserId(
@ -89,25 +102,4 @@ public class BdLeaderInviteBdExe {
return businessDevelopmentBaseInfoService.getByUserId(cmd.getInviteUserId());
}
private void sendMessage(DbLeaderInviteBdCmd cmd) {
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.requiredReqUserId())
);
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile);
String h5Url = enumConfigCacheService.getValue(EnumConfigKey.H5_DOMAIN_BASE_URL_V2,
cmd.requireReqSysOrigin());
if (StringUtils.isBlank(h5Url)) {
return;
}
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
.toAccount(cmd.getInviteUserId())
.noticeType(OfficialNoticeTypeEnum.BD_LEADER_SEND_INVITE_BD)
.templateParam(Map.of("userProfile", String.format("%s(%s)", userProfile.getUserNickname(),
userProfile.actualAccount())))
.expand(h5Url + "/team/bd")
.build()
);
}
}

View File

@ -10,7 +10,8 @@ public class OfficialNoticeUtils {
public static Map<Object, Object> buildUserProfile(UserProfileDTO userProfile) {
return MapBuilder.builder()
.put("userNickname", userProfile.getUserNickname())
.put("account", userProfile.actualAccount())
.put("account", userProfile.getAccount())
.put("actualAccount", userProfile.actualAccount())
.put("userAvatar", userProfile.getUserAvatar())
.put("countryCode", userProfile.getCountryCode())
.put("countryName", userProfile.getCountryName())