|
@@ -3,6 +3,7 @@ package com.zbkj.service.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
import com.zbkj.common.model.organization.OrganizationDepartment;
|
|
import com.zbkj.common.model.organization.OrganizationDepartment;
|
|
@@ -10,6 +11,7 @@ import com.zbkj.common.model.organization.OrganizationDepartment;
|
|
import com.zbkj.common.model.organization.VO.OrganizationDepartmentVO;
|
|
import com.zbkj.common.model.organization.VO.OrganizationDepartmentVO;
|
|
import com.zbkj.common.model.user.UserBypassAccount;
|
|
import com.zbkj.common.model.user.UserBypassAccount;
|
|
import com.zbkj.common.model.user.UserEnterprise;
|
|
import com.zbkj.common.model.user.UserEnterprise;
|
|
|
|
+import com.zbkj.common.result.CommonResult;
|
|
import com.zbkj.service.dao.OrganizationDeparementDao;
|
|
import com.zbkj.service.dao.OrganizationDeparementDao;
|
|
import com.zbkj.service.dao.UserBypassAccountDao;
|
|
import com.zbkj.service.dao.UserBypassAccountDao;
|
|
import com.zbkj.service.dao.UserEnterpriseDao;
|
|
import com.zbkj.service.dao.UserEnterpriseDao;
|
|
@@ -20,6 +22,7 @@ import com.zbkj.service.service.UserEnterpriseService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@@ -70,5 +73,83 @@ public class OrganizationDepartmentServiceImpl extends ServiceImpl<OrganizationD
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CommonResult<?> departUser(String departmentId, String organizationId) {
|
|
|
|
+ if (StringUtils.isNotBlank(departmentId)) {
|
|
|
|
+ List<UserBypassAccount> list = new ArrayList<>();
|
|
|
|
+ String[] split = departmentId.split(",");
|
|
|
|
+ LambdaQueryWrapper<OrganizationDepartment> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.in(OrganizationDepartment::getId, split);
|
|
|
|
+
|
|
|
|
+ List<OrganizationDepartment> departmentList = this.list(queryWrapper);
|
|
|
|
+ for (OrganizationDepartment organizationDepartment : departmentList) {
|
|
|
|
+
|
|
|
|
+ String organizationId1 = organizationDepartment.getOrganizationId();
|
|
|
|
+ String name = organizationDepartment.getName();
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<UserEnterprise> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper2.eq(UserEnterprise::getOrganizationId, organizationId1);
|
|
|
|
+ UserEnterprise userEnterprise2 = userEnterpriseService.getOne(queryWrapper2);
|
|
|
|
+ Integer id2 = userEnterprise2.getId();
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper3.eq(UserBypassAccount::getEnterpriseId, id2);
|
|
|
|
+ queryWrapper3.eq(UserBypassAccount::getDepartment, name);
|
|
|
|
+ queryWrapper3.eq(UserBypassAccount::getIsDelete, 0);
|
|
|
|
+ List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper3);
|
|
|
|
+ for (UserBypassAccount userBypassAccount : list1) {
|
|
|
|
+ list.add(userBypassAccount);
|
|
|
|
+ }
|
|
|
|
+ if (null == list || list.size() == 0) {
|
|
|
|
+ LambdaQueryWrapper<UserEnterprise> queryWrapper4 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper4.eq(UserEnterprise::getOrganizationId, organizationId);
|
|
|
|
+ UserEnterprise userEnterprise4 = userEnterpriseService.getOne(queryWrapper4);
|
|
|
|
+ UserBypassAccount userBypassAccount = new UserBypassAccount();
|
|
|
|
+ userBypassAccount.setId(userEnterprise4.getId());
|
|
|
|
+ userBypassAccount.setEnterpriseId(userEnterprise4.getId());
|
|
|
|
+ userBypassAccount.setUserId(userEnterprise4.getUserId());
|
|
|
|
+ userBypassAccount.setRealName(userEnterprise4.getRealName());
|
|
|
|
+ userBypassAccount.setNickname(userEnterprise4.getNickname());
|
|
|
|
+ userBypassAccount.setPhone(userEnterprise4.getPhone());
|
|
|
|
+ userBypassAccount.setAvatar(userEnterprise4.getAvatar());
|
|
|
|
+ userBypassAccount.setIsDelete(userEnterprise4.getIsDelete());
|
|
|
|
+ userBypassAccount.setDepartment(userEnterprise4.getDepartment());
|
|
|
|
+ userBypassAccount.setDepartmentId(departmentId);
|
|
|
|
+ list.add(userBypassAccount);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return CommonResult.success(list);
|
|
|
|
+ } else if (StringUtils.isNotBlank(organizationId)) {
|
|
|
|
+ LambdaQueryWrapper<UserEnterprise> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(UserEnterprise::getOrganizationId, organizationId);
|
|
|
|
+ UserEnterprise userEnterprise = userEnterpriseService.getOne(queryWrapper);
|
|
|
|
+ Integer id = userEnterprise.getId();
|
|
|
|
+ LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
|
|
|
|
+ queryWrapper2.eq(UserBypassAccount::getIsDelete, 0);
|
|
|
|
+ List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<UserEnterprise> queryWrapper4 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper4.eq(UserEnterprise::getOrganizationId, organizationId);
|
|
|
|
+ UserEnterprise userEnterprise4 = userEnterpriseService.getOne(queryWrapper4);
|
|
|
|
+ UserBypassAccount userBypassAccount = new UserBypassAccount();
|
|
|
|
+ userBypassAccount.setId(userEnterprise4.getId());
|
|
|
|
+ userBypassAccount.setEnterpriseId(userEnterprise4.getId());
|
|
|
|
+ userBypassAccount.setUserId(userEnterprise4.getUserId());
|
|
|
|
+ userBypassAccount.setRealName(userEnterprise4.getRealName());
|
|
|
|
+ userBypassAccount.setNickname(userEnterprise4.getNickname());
|
|
|
|
+ userBypassAccount.setPhone(userEnterprise4.getPhone());
|
|
|
|
+ userBypassAccount.setAvatar(userEnterprise4.getAvatar());
|
|
|
|
+ userBypassAccount.setIsDelete(userEnterprise4.getIsDelete());
|
|
|
|
+ userBypassAccount.setDepartment(userEnterprise4.getDepartment());
|
|
|
|
+ userBypassAccount.setDepartmentId(departmentId);
|
|
|
|
+ list1.add(userBypassAccount);
|
|
|
|
+
|
|
|
|
+ return CommonResult.success(list1);
|
|
|
|
+ }
|
|
|
|
+ return CommonResult.success("部门下用户为空");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|