后台新增换绑bdleader功能

This commit is contained in:
tianfeng 2026-01-13 19:08:15 +08:00
parent 9319ec228a
commit 74e07159e9
8 changed files with 102 additions and 0 deletions

View File

@ -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<Void> deleteById(@RequestParam("id") Long id);
/**
* 换绑BD Leader.
*/
@PostMapping("/changeBdLeader")
ResultResponse<Void> changeBdLeader(@RequestBody @Validated ChangeBdLeaderCmd cmd);
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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<Void> changeBdLeader(ChangeBdLeaderCmd cmd) {
bdTeamInfoClientService.changeBdLeader(cmd);
return ResultResponse.success();
}
}

View File

@ -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);
}

View File

@ -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();
}
}