diff --git a/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java index a1068cf..ac60af9 100644 --- a/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java +++ b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java @@ -93,9 +93,8 @@ public class HrUserAccountController { */ @PostMapping("/delUserAccounts") @ApiOperation(value = "批量删除用户以及账号") - public R delUserAccounts(@RequestBody List ids) { - int result = iHrUserAccountService.delUserAccounts(ids); - return result > 0 ? R.ok("删除成功!") : R.error(); + public R delUserAccounts(@RequestBody List ids) { + return iHrUserAccountService.delUserAccounts(ids); } /** diff --git a/users/src/main/java/com/huoran/users/controller/UserLoginController.java b/users/src/main/java/com/huoran/users/controller/UserLoginController.java index 54fb42e..f7fc87f 100644 --- a/users/src/main/java/com/huoran/users/controller/UserLoginController.java +++ b/users/src/main/java/com/huoran/users/controller/UserLoginController.java @@ -245,8 +245,10 @@ public class UserLoginController { @ApiParam(name = "openId", value = "微信id", required = true) @RequestParam String openId, @ApiParam(name = "userName", value = "用户名称") - @RequestParam String userName){ - return userAccountService.updateAvatars(openId,url,userName); + @RequestParam String userName, + @ApiParam(name = "platformId", value = "平台id") + @RequestParam String platformId){ + return userAccountService.updateAvatars(openId,url,userName,platformId); } /** diff --git a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java index 931e416..b98be0e 100644 --- a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java +++ b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java @@ -54,7 +54,7 @@ public interface IHrUserAccountService extends IService { R examinePassword(ResetPwdReq resetPwdReq); - int delUserAccounts(List ids); + R delUserAccounts(List ids); Integer getUserIdByAccountId(String accountId); @@ -87,5 +87,5 @@ public interface IHrUserAccountService extends IService { UserInfoDetailsRes viewUserDetails(String openId); - R updateAvatars(String openId, String url, String userName); + R updateAvatars(String openId, String url, String userName,String platformId); } diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java index 9934266..517ddba 100644 --- a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java @@ -24,8 +24,7 @@ import com.huoran.users.entity.req.*; import com.huoran.users.entity.res.*; import com.huoran.users.entity.vo.CheckVo; import com.huoran.users.mapper.*; -import com.huoran.users.service.IHrUserAccountService; -import com.huoran.users.service.PlatformLoginService; +import com.huoran.users.service.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.BeanFactory; @@ -59,9 +58,8 @@ public class HrUserAccountServiceImpl extends ServiceImpl ids) { - //删除用户表 - boolean i = hrUserInfoMapper.delUserInfos(ids); - + public R delUserAccounts(List ids) { + List accountList = hrUserAccountMapper.selectList(new QueryWrapper().in("app_open_id", ids)); + List userIds = accountList.stream().map(HrUserAccount::getUserId).collect(Collectors.toList()); + //删除用户信息 + hrUserInfoMapper.deleteBatchIds(userIds); //删除账号表 - boolean n = hrUserAccountMapper.delUserAccounts(ids); - return i & n == true ? 1 : 0; + int delete = hrUserAccountMapper.delete(new QueryWrapper().in("app_open_id", ids)); + //删除平台全部认证信息 + ids.forEach(openId -> { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("open_id", openId); + userAuthenticationInformationMapper.delete(queryWrapper); + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("open_id", openId); + enterpriseCertificationService.remove(queryWrapper1); + }); + return delete > 0 ? R.ok("删除成功!") : R.error(); } @Override @@ -439,10 +448,10 @@ public class HrUserAccountServiceImpl extends ServiceImpl() - .eq("app_open_id", openId).eq("platform_id", 7)); + .eq("app_open_id", openId).eq("platform_id", platformId)); //查询用户信息 HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(hrUserAccount.getUserId()); @@ -451,6 +460,8 @@ public class HrUserAccountServiceImpl extends ServiceImpl0 ? R.ok():R.error();