删除组织信息,及组织下的用户组织信息

main
cheney 10 months ago
parent 20c544fbee
commit 893a76f26b
  1. 2
      common/src/main/java/com/huoran/common/entity/OrganizationInfo.java
  2. 37
      nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java
  3. 7
      nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java
  4. 77
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml
  5. 4
      users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java
  6. 9
      users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java
  7. 51
      users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml
  8. 26
      users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java

@ -1,4 +1,4 @@
package com.huoran.users.entity.res;
package com.huoran.common.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -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<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("open_id", enterpriseCertification.getOpenId());
userAuthenticationInformationService.remove(queryWrapper);
QueryWrapper<EnterpriseCertification> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("open_id", enterpriseCertification.getOpenId());
service.remove(queryWrapper1);
//删除组织信息,及组织下的用户信息
List<OrganizationInfo> organizationInfoList = platformTeamAccountMapper.selectOrganizationInfo(enterpriseCertification.getOpenId());
if (organizationInfoList != null && organizationInfoList.size() > 0) {
for (OrganizationInfo organizationInfo : organizationInfoList) {
//如果是团队负责人,则删除自身团队及成员团队信息
if (organizationInfo.getIsTeam() == 1) {
ArrayList<Integer> getTeamIds = platformTeamAccountMapper.selectTeamIdByClassificationId(organizationInfo.getTeamId().toString());
for (Integer teamId : getTeamIds) {
platformTeamAccountMapper.deleteTeam(teamId);
}
}else {
//删除团队信息
platformTeamAccountMapper.deleteOrganization(organizationInfo.getAccountId());
}
}
}
}
boolean delState = service.removeByIds(ids);

@ -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<PlatformTeamAccoun
Long selectShopIdByOpenId(@Param("openId")String openId,@Param("platformId") Integer platformId);
UserAccount selectAccountPlatform(@Param("accountId")String accountId);
List<OrganizationInfo> selectOrganizationInfo(@Param("openId")String openId);
void deleteTeam(@Param("teamId")Integer teamId);
void deleteOrganization(@Param("accountId")Integer accountId);
}

@ -192,4 +192,81 @@
from hr_user_account
WHERE is_del = 0 and id = #{accountId}
</select>
<update id="deleteOrganization">
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>
<update id="deleteTeam">
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}
</update>
<select id="selectOrganizationInfo" resultType="com.huoran.common.entity.OrganizationInfo">
SELECT
CASE
WHEN he_parent.audit_status = 2 THEN
ec.company_name
ELSE
CASE
WHEN tc.is_team = 0 THEN
tc_parent.classification_name
ELSE
tc.classification_name
END
END AS organizationName,
ta.platform_id AS platform_id,
CASE
WHEN tc.is_team = 0 THEN
he_parent.credit_code
ELSE
ec.credit_code
END as credit_code,
CASE
WHEN tc.is_team = 0 THEN
CASE
WHEN he_parent.audit_status = 2 THEN '已认证'
WHEN he_parent.audit_status = 0 THEN '未提交'
WHEN he_parent.audit_status = 1 THEN '待审核'
ELSE '已驳回'
END
ELSE
CASE
WHEN ec.audit_status = 2 THEN '已认证'
WHEN ec.audit_status = 0 THEN '未提交'
WHEN ec.audit_status = 1 THEN '待审核'
ELSE '已驳回'
END
END
AS authentication,
pt.classification_id AS teamId,
ta.account_id,
tc.is_enable,
CASE
WHEN tc.is_team = 0 THEN
he_parent.audit_status
ELSE
ec.audit_status
END as audit_status,
ta.manage_id ,tc.is_team,tc.parent_id
FROM
hr_user_account hu
LEFT JOIN hr_enterprise_certification ec ON hu.app_open_id = ec.open_id
AND ec.platform_source = hu.platform_id
INNER JOIN k_platform_team_account ta ON ta.account_id = hu.id
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
AND tc.is_del = 0
LEFT JOIN k_platform_team_classification tc_parent ON tc.parent_id = tc_parent.id AND tc_parent.is_del = 0
LEFT JOIN hr_enterprise_certification he_parent ON hu.app_open_id = he_parent.open_id AND tc_parent.id = pt.classification_id
WHERE
hu.app_open_id = #{openId}
AND hu.is_del = 0
</select>
</mapper>

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

@ -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<HrUserAccount> {
List<OrganizationInfo> selectOrganizationInfo(@Param("openId")String openId);
int selectTeamByOpenId(String id);
void deleteOrganization(@Param("accountId")Integer accountId);
ArrayList<Integer> selectTeamId(@Param("teamId")Integer teamId);
void deleteTeam(@Param("teamId")Integer teamId);
}

@ -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());
</insert>
<update id="deleteOrganization">
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>
<update id="deleteTeam">
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}
</update>
<!-- 通用查询映射结果 -->
<!--<resultMap id="getDataUserListMap" type="com.huoran.users.entity.res.DataUserInfoResp">
@ -1097,7 +1109,7 @@
AND a.account_id = #{id}
AND c.is_del = 0
</select>
<select id="selectOrganizationInfo" resultType="com.huoran.users.entity.res.OrganizationInfo">
<select id="selectOrganizationInfo" resultType="com.huoran.common.entity.OrganizationInfo">
SELECT
CASE
WHEN he_parent.audit_status = 2 THEN
@ -1110,7 +1122,7 @@
tc.classification_name
END
END AS organizationName,
ec.platform_source AS platform_id,
ta.platform_id AS platform_id,
CASE
WHEN tc.is_team = 0 THEN
@ -1122,13 +1134,17 @@
CASE
WHEN tc.is_team = 0 THEN
CASE
WHEN he_parent.audit_status = 2 THEN
'已认证' ELSE '未认证或审核中'
WHEN he_parent.audit_status = 2 THEN '已认证'
WHEN he_parent.audit_status = 0 THEN '未提交'
WHEN he_parent.audit_status = 1 THEN '待审核'
ELSE '已驳回'
END
ELSE
CASE
WHEN ec.audit_status = 2 THEN
'已认证' ELSE '未认证或审核中'
WHEN ec.audit_status = 2 THEN '已认证'
WHEN ec.audit_status = 0 THEN '未提交'
WHEN ec.audit_status = 1 THEN '待审核'
ELSE '已驳回'
END
END
AS authentication,
@ -1150,7 +1166,7 @@
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
AND tc.is_del = 0
LEFT JOIN k_platform_team_classification tc_parent ON tc.parent_id = tc_parent.id
LEFT JOIN k_platform_team_classification tc_parent ON tc.parent_id = tc_parent.id AND tc_parent.is_del = 0
LEFT JOIN hr_enterprise_certification he_parent ON hu.app_open_id = he_parent.open_id AND tc_parent.id = pt.classification_id
WHERE
hu.app_open_id = #{openId}
@ -1169,6 +1185,27 @@
AND a.is_del = 0
AND a.platform_id !=7
</select>
<select id="selectTeamId" resultType="java.lang.Integer">
SELECT
DATA.id
FROM
(
SELECT
@ids AS _ids,
( SELECT @ids := GROUP_CONCAT( id ) FROM k_platform_team_classification WHERE FIND_IN_SET( parent_id, @ids ) ) AS cids,
@l := @l + 1 AS LEVEL
FROM
k_platform_team_classification,
( SELECT @ids := #{teamId}, @l := 0 ) b
WHERE
@ids IS NOT NULL
) ID,
k_platform_team_classification DATA
WHERE
FIND_IN_SET( DATA.id, ID._ids )
ORDER BY
id DESC
</select>
<update id="unbindMobilePhone" parameterType="java.lang.Integer">
UPDATE hr_user_account

@ -8,10 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.common.constant.DelConstant;
import com.huoran.common.constant.PlatformConstant;
import com.huoran.common.constant.SMSTemplate;
import com.huoran.common.entity.FilesResult;
import com.huoran.common.entity.*;
import com.huoran.common.entity.Student;
import com.huoran.common.entity.UserAccount;
import com.huoran.common.entity.UserInfo;
import com.huoran.common.entity.resp.PhoneBindingrResp;
import com.huoran.common.exception.CustomException;
import com.huoran.common.exception.ExceptionEnum;
@ -20,6 +18,8 @@ import com.huoran.common.utils.AliyunOssUtil;
import com.huoran.common.utils.DateUtil;
import com.huoran.common.utils.MD5;
import com.huoran.users.entity.*;
import com.huoran.users.entity.EnterpriseCertification;
import com.huoran.users.entity.UserAuthenticationInformation;
import com.huoran.users.entity.req.*;
import com.huoran.users.entity.res.*;
import com.huoran.users.entity.vo.CheckVo;
@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -142,6 +143,25 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
queryWrapper1.eq("open_id", openId);
enterpriseCertificationService.remove(queryWrapper1);
});
//删除组织信息,及组织下的用户信息
for (HrUserAccount hrUserAccount : accountList) {
List<OrganizationInfo> organizationInfoList = baseMapper.selectOrganizationInfo(hrUserAccount.getAppOpenId());
if (organizationInfoList != null && organizationInfoList.size() > 0) {
for (OrganizationInfo organizationInfo : organizationInfoList) {
//如果是团队负责人,则删除自身团队及成员团队信息
if (organizationInfo.getIsTeam() == 1) {
ArrayList<Integer> getTeamIds = baseMapper.selectTeamId(organizationInfo.getTeamId());
for (Integer teamId : getTeamIds) {
baseMapper.deleteTeam(teamId);
}
}else {
//删除团队信息
baseMapper.deleteOrganization(organizationInfo.getAccountId());
}
}
}
}
return delete > 0 ? R.ok("删除成功!") : R.error();
}

Loading…
Cancel
Save