From 893a76f26bd731b804ad34b6a1d738c77d3c9ad6 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Fri, 26 Jan 2024 15:00:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=8F=8A=E7=BB=84=E7=BB=87=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E7=BB=84=E7=BB=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity}/OrganizationInfo.java | 2 +- .../EnterpriseCertificationController.java | 37 ++++++++- .../mapper/PlatformTeamAccountMapper.java | 7 ++ .../mapper/xml/PlatformTeamAccountMapper.xml | 77 +++++++++++++++++++ .../users/entity/res/UserInfoDetailsRes.java | 4 +- .../users/mapper/HrUserAccountMapper.java | 9 ++- .../users/mapper/xml/HrUserAccountMapper.xml | 51 ++++++++++-- .../impl/HrUserAccountServiceImpl.java | 58 +++++++++----- 8 files changed, 213 insertions(+), 32 deletions(-) rename {users/src/main/java/com/huoran/users/entity/res => common/src/main/java/com/huoran/common/entity}/OrganizationInfo.java (95%) diff --git a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java b/common/src/main/java/com/huoran/common/entity/OrganizationInfo.java similarity index 95% rename from users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java rename to common/src/main/java/com/huoran/common/entity/OrganizationInfo.java index f1a0b81..11cc9c5 100644 --- a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java +++ b/common/src/main/java/com/huoran/common/entity/OrganizationInfo.java @@ -1,4 +1,4 @@ -package com.huoran.users.entity.res; +package com.huoran.common.entity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java index 19c3a49..96e6dc2 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java @@ -1,14 +1,18 @@ package com.huoran.nakadai.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.entity.OrganizationInfo; import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserAuthenticationInformation; import com.huoran.common.response.R; import com.huoran.common.utils.TokenUtils; import com.huoran.common.entity.EnterpriseCertification; import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq; import com.huoran.nakadai.entity.vo.WxMssVo; +import com.huoran.nakadai.mapper.PlatformTeamAccountMapper; import com.huoran.nakadai.service.EnterpriseCertificationService; +import com.huoran.nakadai.service.UserAuthenticationInformationService; import com.huoran.nakadai.utils.WeChatUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -20,6 +24,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -42,6 +47,12 @@ public class EnterpriseCertificationController { @Autowired public EnterpriseCertificationService service; + @Autowired + public UserAuthenticationInformationService userAuthenticationInformationService; + + @Autowired + public PlatformTeamAccountMapper platformTeamAccountMapper; + /** * 由前台申请认证后才有后台认证记录,认证状态有 待审核、已通过、未驳回三种状态,没有未提交这种状态 @@ -203,7 +214,31 @@ public class EnterpriseCertificationController { service.deleteUserInformation(userAccount.getUserId()); //删除团队信息表 - service.deleteTeamInformation(userAccount.getId()); +// service.deleteTeamInformation(userAccount.getId()); + //删除平台全部认证信息 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("open_id", enterpriseCertification.getOpenId()); + userAuthenticationInformationService.remove(queryWrapper); + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("open_id", enterpriseCertification.getOpenId()); + service.remove(queryWrapper1); + //删除组织信息,及组织下的用户信息 + List organizationInfoList = platformTeamAccountMapper.selectOrganizationInfo(enterpriseCertification.getOpenId()); + if (organizationInfoList != null && organizationInfoList.size() > 0) { + for (OrganizationInfo organizationInfo : organizationInfoList) { + //如果是团队负责人,则删除自身团队及成员团队信息 + if (organizationInfo.getIsTeam() == 1) { + ArrayList getTeamIds = platformTeamAccountMapper.selectTeamIdByClassificationId(organizationInfo.getTeamId().toString()); + for (Integer teamId : getTeamIds) { + platformTeamAccountMapper.deleteTeam(teamId); + } + }else { + //删除团队信息 + platformTeamAccountMapper.deleteOrganization(organizationInfo.getAccountId()); + } + } + } } boolean delState = service.removeByIds(ids); diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java index 4b5eae3..bf149c0 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java @@ -2,6 +2,7 @@ package com.huoran.nakadai.mapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.OrganizationInfo; import com.huoran.common.entity.UserAccount; import com.huoran.nakadai.entity.PlatformTeamAccount; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -46,4 +47,10 @@ public interface PlatformTeamAccountMapper extends BaseMapper selectOrganizationInfo(@Param("openId")String openId); + + void deleteTeam(@Param("teamId")Integer teamId); + + void deleteOrganization(@Param("accountId")Integer accountId); } 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 6d4660a..c79971d 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 @@ -192,4 +192,81 @@ from hr_user_account WHERE is_del = 0 and id = #{accountId} + + + UPDATE k_platform_team_account ta + INNER JOIN k_platform_team pt ON ta.manage_id = pt.manage_id + INNER JOIN k_platform_team_classification tc ON tc.id = pt.classification_id + set ta.is_del = 1,tc.is_del=1 where ta.account_id = #{accountId} + + + UPDATE k_platform_team_account ta + INNER JOIN k_platform_team pt ON ta.manage_id = pt.manage_id + INNER JOIN k_platform_team_classification tc ON tc.id = pt.classification_id + set ta.is_del = 1,tc.is_del=1 where tc.id = #{teamId} + + + diff --git a/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java b/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java index c19df85..99819be 100644 --- a/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java +++ b/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java @@ -1,8 +1,6 @@ package com.huoran.users.entity.res; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; - +import com.huoran.common.entity.OrganizationInfo; import com.huoran.common.entity.resp.PhoneBindingrResp; import com.huoran.users.entity.*; import io.swagger.annotations.ApiModelProperty; diff --git a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java index c16c4ab..305e9bd 100644 --- a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java +++ b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java @@ -9,12 +9,13 @@ import com.huoran.common.entity.UserInfo; import com.huoran.users.entity.HrUserAccount; import com.huoran.users.entity.req.UserInfoReq; import com.huoran.users.entity.res.DataUserInfoResp; -import com.huoran.users.entity.res.OrganizationInfo; +import com.huoran.common.entity.OrganizationInfo; import com.huoran.users.entity.res.UserAccountListRes; import com.huoran.users.entity.res.UserInfoListRes; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -65,4 +66,10 @@ public interface HrUserAccountMapper extends BaseMapper { List selectOrganizationInfo(@Param("openId")String openId); int selectTeamByOpenId(String id); + + void deleteOrganization(@Param("accountId")Integer accountId); + + ArrayList selectTeamId(@Param("teamId")Integer teamId); + + void deleteTeam(@Param("teamId")Integer teamId); } diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml index 42e2d57..3996d95 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -24,6 +24,18 @@ INSERT INTO occupationlab.ol_student(`account_id`, `class_id`, `school_id`, `create_time`, `update_time`) VALUES (#{accountId}, #{classId}, #{schoolId}, now(), now()); + + UPDATE k_platform_team_account ta + INNER JOIN k_platform_team pt ON ta.manage_id = pt.manage_id + INNER JOIN k_platform_team_classification tc ON tc.id = pt.classification_id + set ta.is_del = 1,tc.is_del=1 where ta.account_id = #{accountId} + + + UPDATE k_platform_team_account ta + INNER JOIN k_platform_team pt ON ta.manage_id = pt.manage_id + INNER JOIN k_platform_team_classification tc ON tc.id = pt.classification_id + set ta.is_del = 1,tc.is_del=1 where tc.id = #{teamId} +