删除企业认证信息的同时增加删除团队、用户、账户信息逻辑

main
rong.liu 11 months ago
parent d7bb725604
commit 8478119ad7
  1. 36
      users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java

@ -1,11 +1,16 @@
package com.huoran.users.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.users.entity.EnterpriseCertification;
import com.huoran.users.entity.HrUserAccount;
import com.huoran.users.entity.HrUserInfo;
import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
import com.huoran.users.service.EnterpriseCertificationService;
import com.huoran.users.service.IHrUserAccountService;
import com.huoran.users.service.IHrUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -34,6 +39,12 @@ public class EnterpriseCertificationController {
@Autowired
public EnterpriseCertificationService service;
@Autowired
public IHrUserAccountService userAccountService;
@Autowired
public IHrUserInfoService userInfoService;
/**
* 由前台申请认证后才有后台认证记录认证状态有 待审核已通过未驳回三种状态没有未提交这种状态
@ -98,8 +109,7 @@ public class EnterpriseCertificationController {
@PostMapping("/informationAudit")
@ApiOperation(value = "信息审核", response = EnterpriseCertification.class)
public R informationAudit(@ApiParam(name = "auditStatus", value = "审核状态(2.通过,3.不通过)", required = true) @RequestParam Integer auditStatus,
@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
public R informationAudit(@ApiParam(name = "auditStatus", value = "审核状态(2.通过,3.不通过)", required = true) @RequestParam Integer auditStatus, @ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
// String accountId = TokenUtils.getIdByJwtToken(request);
EnterpriseCertification enterpriseCertification = new EnterpriseCertification();
@ -124,6 +134,28 @@ public class EnterpriseCertificationController {
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = EnterpriseCertification.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
for (Integer id : ids) {
//
EnterpriseCertification enterpriseCertification = service.getById(id);
//删除企业认证后同步删除团队、用户、账户信息
//删除账号表
QueryWrapper<HrUserAccount> accountQueryWrapper1 = new QueryWrapper<>();
accountQueryWrapper1.eq("id", enterpriseCertification.getAccountId());
HrUserAccount userAccount = userAccountService.getOne(accountQueryWrapper1);
userAccountService.removeById(userAccount);
//删除用户表
userInfoService.removeById(userAccount.getUserId());
//删除团队信息表
service.deleteTeamInformation(enterpriseCertification.getAccountId());
}
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}

Loading…
Cancel
Save