diff --git a/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java b/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java index 250693a..5e58d0f 100644 --- a/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java +++ b/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java @@ -60,6 +60,8 @@ public enum ExceptionEnum { DATA_PLATFORM_ACCOUNT_AVALIABLE_FAIL(10022, "当前用户所在的院校在数据平台的可用账号数量不足,是否继续!"), INVITATION_CODE_EXPIRED(10023, "邀请码已失效"), USER_ALREADY_EXISTS_GROUP(10024, "用户已存在该组织"), + + USER_ALREADY_EXISTS_OTHER_GROUP(10024, "无法受邀加入该平台组织,账号已在其他平台存在组织信息!"), CANT_JOIN_TEAM(10025, "无法加入自己的团队"), CANNOT_ADDED_REPEATEDLY(10026, "该用户已经是团队管理员,无法重复添加!"), DEFAULT_ROLE_NOTEXIST(10027, "默认角色不存在"), diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java index 4fb6eb1..be0d108 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java @@ -136,50 +136,35 @@ public class PlatformTeamAccountController { // return platformTeamAccountService.transferAdmin(transferAdminReq); // } -// @PostMapping("/transferTeam") -// @ApiOperation(value = "团队内转让超管") -// public R transferTeam(@RequestBody @Valid TransferTeamReq transferTeamReq) { -// return platformTeamAccountService.transferTeam(transferTeamReq); -// } - - -// @PostMapping("/delPartnerAccount") -// @ApiOperation(value = "删除合伙人") -// public R delPartnerAccount( -// @ApiParam(name = "accountId", value = "账号id") -// @RequestParam Integer accountId) { -// return platformTeamAccountService.delPartnerAccount(accountId); -// } + @PostMapping("/transferTeam") + @ApiOperation(value = "团队内转让超管") + public R transferTeam(@RequestBody @Valid TransferTeamReq transferTeamReq) { + return platformTeamAccountService.transferTeam(transferTeamReq); + } -// @GetMapping("/partnerRemoval") -// @ApiOperation(value = "移除团队") -// public R partnerRemoval( -// @ApiParam(name = "teamId", value = "团队id") -// @RequestParam String teamId, -// @ApiParam(name = "partnerId", value = "合伙人id") -// @RequestParam String partnerId) { -// PartnerClassification partnerClassification = partnerClassificationService.getById(teamId); -// if (partnerClassification.getIsTeam() == 1) { -// throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); -// } -// PartnerAccount partnerAccount = platformTeamAccountService.getById(partnerId); -// //删除团队成员 -// partnerClassificationService.removeById(Integer.parseInt(teamId)); -// //同步删除该团队相关角色信息 -// partnerClassificationService.removeRole(teamId,partnerAccount.getAccountId()); -// return partnerTeamService.remove(new QueryWrapper(). -// eq("partner_id", partnerId). -// eq("classification_id", teamId)) ? R.ok() : R.error(); -// } - + @GetMapping("/removeOrganization") + @ApiOperation(value = "移除组织") + public R removeOrganization( + @ApiParam(name = "teamId", value = "团队id") + @RequestParam Integer teamId, + @ApiParam(name = "manageId", value = "组织id") + @RequestParam Integer manageId) { + PlatformTeamClassification teamClassification = platformTeamClassificationService.getById(teamId); + if (teamClassification.getIsTeam() == 1) { + throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); + } + //删除团队成员 + platformTeamClassificationService.removeById(teamId); + //TODO 删除该团队相关角色信息 + platformTeamAccountService.removeById(manageId); + boolean remove = platformTeamService.remove(new QueryWrapper(). + eq("manage_id", manageId). + eq("classification_id", teamId)); + return remove ? R.ok() : R.error(); + } -// @ApiOperation(value = "查询合伙人账号信息") -// @PostMapping("/queryPartnerAccount") -// public R queryPartnerAccount(@RequestParam String phone) { -// return platformTeamAccountService.queryPartnerAccount(phone); -// } - @ApiOperation(value = "后台更新团队状态,禁用无法切换到该组织") + @ApiOperation(value = "后台更新团队状态,禁用无法查询到该组织") @PostMapping("/updateTeamStatus") public R updateTeamStatus( @RequestParam("teamId") @ApiParam(value = "团队id") Integer teamId, diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java index 817f1d5..2e48fef 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java @@ -11,12 +11,18 @@ import lombok.Data; @Data public class TransferTeamReq { - @ApiModelProperty(value = "管理员合伙人id") - private Integer adminPartnerId; + @ApiModelProperty(value = "管理员组织id") + private Integer adminManageId; + + @ApiModelProperty(value = "成员组织id") + private Integer memberManageId; @ApiModelProperty(value = "管理员团队id") private Integer adminTeamId; + @ApiModelProperty(value = "管理员合伙人id") + private Integer adminPartnerId; + @ApiModelProperty(value = "成员合伙人id") private Integer memberPartnerId; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/PlatformTeamAccountResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PlatformTeamAccountResp.java index ddc0794..249ced8 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/res/PlatformTeamAccountResp.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PlatformTeamAccountResp.java @@ -82,8 +82,11 @@ public class PlatformTeamAccountResp { @ApiModelProperty(value = "商务经理ids") private List businessManagerIds; -// @ApiModelProperty(value = "团队信息") -// private PartnerClassification partnerClassificationList; + @ApiModelProperty(value = "加入时间") + private String joinTime; + + @ApiModelProperty(value = "是否认证") + private String authentication; @ApiModelProperty(value = "是否是团队") private String isTeam; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamAccountResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamAccountResp.java index 090417d..39a882a 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamAccountResp.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamAccountResp.java @@ -95,4 +95,10 @@ public class TeamAccountResp { @ApiModelProperty(value = "团队名称") private String teamName; + @ApiModelProperty(value = "加入时间") + private String joinTime; + + @ApiModelProperty(value = "是否认证") + private String authentication; + } diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml index acba710..1a23524 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml @@ -68,24 +68,23 @@ c.parent_id, a.account_id, c.is_team, - ( - SELECT - u.user_name - FROM - hr_user_info u - INNER JOIN hr_user_account ua - WHERE - ua.user_id = u.user_id - AND a.account_id = ua.id - ) AS userName + u.user_name, + c.create_time as joinTime, + CASE + WHEN count(ai.id) > 0 THEN '已认证' + ELSE '未认证' + END as authentication FROM k_platform_team t INNER JOIN k_platform_team_classification c ON c.id = t.classification_id INNER JOIN k_platform_team_account a ON a.manage_id = t.manage_id + INNER join hr_user_account ua on ua.id = a.account_id + INNER JOIN hr_user_info u on ua.user_id = u.user_id + left join hr_user_authentication_information ai on ai.open_id = ua.app_open_id WHERE c.is_del = 0 and c.is_enable = 0 AND a.is_del = 0 and a.platform_id = #{platformId} - AND account_id = #{accountId} + AND a.account_id = #{accountId}