From 74e07159e9f0a9ea129a6bf56ba8a304d22a541f Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 13 Jan 2026 19:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=96=B0=E5=A2=9E=E6=8D=A2?= =?UTF-8?q?=E7=BB=91bdleader=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/bd/api/BdTeamInfoClientApi.java | 7 ++++ .../model/cmd/team/bd/ChangeBdLeaderCmd.java | 32 +++++++++++++++++++ .../app/team/bd/TeamBdInfoRestController.java | 11 +++++++ .../app/team/bd/TeamBDInfoServiceImpl.java | 6 ++++ .../app/team/bd/TeamBDInfoService.java | 6 ++++ .../team/bd/BdTeamInfoClientEndpoint.java | 7 ++++ .../service/team/BdTeamInfoClientService.java | 6 ++++ .../impl/BdTeamInfoClientServiceImpl.java | 27 ++++++++++++++++ 8 files changed, 102 insertions(+) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/team/bd/ChangeBdLeaderCmd.java diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/team/bd/api/BdTeamInfoClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/team/bd/api/BdTeamInfoClientApi.java index c484dcb1..2d678640 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/team/bd/api/BdTeamInfoClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/team/bd/api/BdTeamInfoClientApi.java @@ -6,6 +6,7 @@ import com.red.circle.other.inner.model.cmd.team.BdTeamInfoCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; import java.util.List; import java.util.Map; @@ -98,4 +99,10 @@ public interface BdTeamInfoClientApi { @GetMapping("/deleteById") ResultResponse deleteById(@RequestParam("id") Long id); + /** + * 换绑BD Leader. + */ + @PostMapping("/changeBdLeader") + ResultResponse changeBdLeader(@RequestBody @Validated ChangeBdLeaderCmd cmd); + } diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/team/bd/ChangeBdLeaderCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/team/bd/ChangeBdLeaderCmd.java new file mode 100644 index 00000000..50851df3 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/team/bd/ChangeBdLeaderCmd.java @@ -0,0 +1,32 @@ +package com.red.circle.other.inner.model.cmd.team.bd; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.Command; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 换绑BD Leader命令 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class ChangeBdLeaderCmd extends Command implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + @NotNull(message = "BD记录ID不能为空") + @JsonSerialize(using = ToStringSerializer.class) + private Long bdId; + + @NotNull(message = "新BD Leader用户ID不能为空") + @JsonSerialize(using = ToStringSerializer.class) + private Long newAccount; + + private Long updateUser; +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/team/bd/TeamBdInfoRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/team/bd/TeamBdInfoRestController.java index 3b96b19e..10f51bdc 100644 --- a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/team/bd/TeamBdInfoRestController.java +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/team/bd/TeamBdInfoRestController.java @@ -10,6 +10,7 @@ import com.red.circle.framework.web.controller.BaseController; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -77,5 +78,15 @@ public class TeamBdInfoRestController extends BaseController { teamBDInfoService.deleteById(id, getReqUserId()); } + /** + * 换绑BD Leader. + */ + @OpsOperationReqLog("换绑BD Leader") + @PostMapping("/change-bd-leader") + public void changeBdLeader(@RequestBody @Validated ChangeBdLeaderCmd cmd) { + cmd.setUpdateUser(getReqUserId()); + teamBDInfoService.changeBdLeader(cmd); + } + } diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoServiceImpl.java index 734a93b2..d95e4db6 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoServiceImpl.java @@ -25,6 +25,7 @@ import com.red.circle.other.inner.enums.material.BadgeKeyEnum; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.cmd.user.InviteStatisticsQryCmd; import com.red.circle.other.inner.model.dto.agency.agency.TeamApplicationProcessApprovalDTO; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; @@ -425,4 +426,9 @@ public class TeamBDInfoServiceImpl implements TeamBDInfoService { } + @Override + public void changeBdLeader(ChangeBdLeaderCmd cmd) { + bdTeamInfoClient.changeBdLeader(cmd); + } + } diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoService.java index 1d6aaef5..94204b10 100644 --- a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoService.java +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/team/bd/TeamBDInfoService.java @@ -7,6 +7,7 @@ import com.red.circle.framework.dto.PageResult; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; /** @@ -48,5 +49,10 @@ public interface TeamBDInfoService { */ void deleteById(Long id, Long createUserId); + /** + * 换绑BD Leader. + */ + void changeBdLeader(ChangeBdLeaderCmd cmd); + } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/team/bd/BdTeamInfoClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/team/bd/BdTeamInfoClientEndpoint.java index 16f1ea24..22be885d 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/team/bd/BdTeamInfoClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/team/bd/BdTeamInfoClientEndpoint.java @@ -8,6 +8,7 @@ import com.red.circle.other.inner.model.cmd.team.BdTeamInfoCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; import java.util.List; import java.util.Map; @@ -98,4 +99,10 @@ public class BdTeamInfoClientEndpoint implements BdTeamInfoClientApi { return ResultResponse.success(); } + @Override + public ResultResponse changeBdLeader(ChangeBdLeaderCmd cmd) { + bdTeamInfoClientService.changeBdLeader(cmd); + return ResultResponse.success(); + } + } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/BdTeamInfoClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/BdTeamInfoClientService.java index b0314c52..3fe12aab 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/BdTeamInfoClientService.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/BdTeamInfoClientService.java @@ -5,6 +5,7 @@ import com.red.circle.other.inner.model.cmd.team.BdTeamInfoCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; import java.util.List; import java.util.Map; @@ -78,4 +79,9 @@ public interface BdTeamInfoClientService { */ void deleteById(Long id); + /** + * 换绑BD Leader. + */ + void changeBdLeader(ChangeBdLeaderCmd cmd); + } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/BdTeamInfoClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/BdTeamInfoClientServiceImpl.java index c2c27723..e5389b4c 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/BdTeamInfoClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/BdTeamInfoClientServiceImpl.java @@ -1,6 +1,9 @@ package com.red.circle.other.app.inner.service.team.impl; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentBaseInfo; import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.app.inner.convertor.team.BdInnerConvertor; @@ -9,6 +12,7 @@ import com.red.circle.other.inner.model.cmd.team.BdTeamInfoCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamPageQryCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamUpdateOpsCmd; import com.red.circle.other.inner.model.cmd.team.bd.BdTeamWorkStatisticsQryCmd; +import com.red.circle.other.inner.model.cmd.team.bd.ChangeBdLeaderCmd; import com.red.circle.other.inner.model.dto.agency.bd.BdTeamInfoDTO; import com.red.circle.tool.core.text.StringUtils; import java.util.List; @@ -29,6 +33,7 @@ public class BdTeamInfoClientServiceImpl implements BdTeamInfoClientService { private final BdInnerConvertor bdAppConvertor; private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService; + private final UserProfileGateway userProfileGateway; @Override public Boolean check(Long userId) { @@ -133,5 +138,27 @@ public class BdTeamInfoClientServiceImpl implements BdTeamInfoClientService { businessDevelopmentBaseInfoService.removeById(id); } + @Override + public void changeBdLeader(ChangeBdLeaderCmd cmd) { + // 查询BD记录 + BusinessDevelopmentBaseInfo bdInfo = businessDevelopmentBaseInfoService.getById(cmd.getBdId()); + if (Objects.isNull(bdInfo)) { + throw new RuntimeException("BD记录不存在"); + } + + // 校验新BD Leader是否存在 + UserProfile userProfile = userProfileGateway.getByAccount(SysOriginPlatformEnum.LIKEI.name(), String.valueOf(cmd.getNewAccount())); + if (userProfile == null) { + throw new RuntimeException("用户不存在"); + } + + // 修改BD Leader + businessDevelopmentBaseInfoService.update() + .set(BusinessDevelopmentBaseInfo::getBdLeadUserId, userProfile.getId()) + .set(BusinessDevelopmentBaseInfo::getUpdateUser, cmd.getUpdateUser()) + .eq(BusinessDevelopmentBaseInfo::getId, cmd.getBdId()) + .execute(); + } + }