diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java index 98b56e69..58e205b3 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java @@ -107,7 +107,12 @@ public enum TeamErrorCode implements IResponseErrorCode { */ USER_IS_ALREADY_A_BD(6028, "User is already a BD"), - /** + /** + * 用户已经是BDLEADER. + */ + USER_IS_ALREADY_A_BDLEADER(6028, "User is already a BD Leader"), + + /** * 用户不是BD. */ USER_IS_NOT_BD(6029, "User is not BD"), diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java index 656d0a20..7333a72b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java @@ -106,14 +106,13 @@ public class BdLeaderInviteBdExe { roomBdLeadService.checkBdLeader(cmd.requiredReqUserId())); // 权限不足 - ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, + ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, roomBdLeadService.checkBdLeader(cmd.getInviteUserId())); List bdUserIds = businessDevelopmentBaseInfoService.listBdUserIdsByLeaderId(cmd.requiredReqUserId()); ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, bdUserIds.contains(cmd.getInviteUserId())); - // 消息已发送 ResponseAssert.isFalse(TeamErrorCode.MESSAGE_PROCESSED, bdInviteAgentMessageService.existsWaitMessage(cmd.requiredReqUserId(), diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteMessageProcessExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteMessageProcessExe.java index a81d1063..a9d37a13 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteMessageProcessExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteMessageProcessExe.java @@ -1,8 +1,5 @@ package com.red.circle.other.app.command.team; -import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; -import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd; -import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.framework.core.response.ResponseErrorCode; @@ -10,9 +7,7 @@ import com.red.circle.mq.business.model.event.BadgeOperateEvent; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.mq.rocket.business.producer.UserMqMessageService; -import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.team.DbInviteMessageProcessCmd; -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; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamApplicationProcessApproval; @@ -24,16 +19,13 @@ import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.infra.database.rds.service.team.RoomBdLeadService; import com.red.circle.other.infra.database.rds.service.team.UserHistoryIdentityService; -import com.red.circle.other.inner.asserts.user.UserErrorCode; import com.red.circle.other.inner.enums.material.BadgeKeyEnum; -import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.asserts.team.TeamErrorCode; import com.red.circle.other.inner.enums.team.TeamAppProcessApprovalReason; import com.red.circle.other.inner.enums.team.TeamApplicationType; -import com.red.circle.tool.core.collection.MapBuilder; import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; -import com.red.circle.tool.core.json.JacksonUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; import com.red.circle.tool.core.text.StringUtils; import java.util.Objects; import lombok.RequiredArgsConstructor; @@ -136,7 +128,7 @@ public class BdLeaderInviteMessageProcessExe { Objects.equals(message.getGroup(), MessageInviteGroup.BD_LEADER_INVITE_BD_LEADER.name())); ResponseAssert - .isTrue(TeamErrorCode.USER_NOT_BDLEADER, + .isFalse(TeamErrorCode.USER_IS_ALREADY_A_BDLEADER, roomBdLeadService.checkBdLeader(cmd.requiredReqUserId())); ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, @@ -151,8 +143,15 @@ public class BdLeaderInviteMessageProcessExe { MessageInviteGroup.BD_LEADER_INVITE_BD_LEADER.name())); if (Objects.equals(cmd.getStatus(), 1)) { - // 创建BD + RoomBdLead bdLead = new RoomBdLead(); + bdLead.setId(IdWorkerUtils.getId()); + bdLead.setUserId(cmd.requiredReqUserId()); + bdLead.setSysOrigin(roomBdLead.getSysOrigin()); + bdLead.setRegionId(roomBdLead.getRegionId()); + bdLead.setCreateUser(cmd.requiredReqUserId()); + roomBdLeadService.save(bdLead); + businessDevelopmentBaseInfoService.add(new BusinessDevelopmentBaseInfo() .setSysOrigin(cmd.requireReqSysOrigin()) .setBdLeadUserId(message.getUserId()) @@ -174,6 +173,10 @@ public class BdLeaderInviteMessageProcessExe { // 发送管理员任务消息 sendAdminTaskMessage(message.getUserId(), 13); + + userMqMessageService.sendBadgeOperateEvent(cmd.requiredReqUserId(), BadgeKeyEnum.BD.name(), BadgeOperateEvent.OperationType.WEAR.name()); + userMqMessageService.sendBadgeOperateEvent(cmd.requiredReqUserId(), BadgeKeyEnum.BD_LEADER.name(), BadgeOperateEvent.OperationType.WEAR.name()); + } }