|
@@ -1,12 +1,10 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.entity.Organization;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.service.ImUserFriendService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -18,10 +16,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.api.enums.YesOrNoEnum;
|
|
|
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
import com.ym.mec.biz.dal.dto.EmployeeDto;
|
|
|
import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
|
|
|
import com.ym.mec.biz.dal.dto.SimpleUserDto;
|
|
@@ -42,6 +36,7 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
@Service
|
|
|
public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> implements EmployeeService {
|
|
@@ -62,6 +57,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> imp
|
|
|
private ClassGroupDao classGroupDao;
|
|
|
@Autowired
|
|
|
private ImUserFriendService imUserFriendService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Employee> getDAO() {
|
|
@@ -149,6 +146,27 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> imp
|
|
|
pageInfo.setTotal(count);
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = employeeDao.queryEmployByOrganId(params);
|
|
|
+ List<Integer> allOrganIds = new ArrayList<>();
|
|
|
+ for (EmployeeDto employeeDto : dataList) {
|
|
|
+ if(StringUtils.isBlank(employeeDto.getOrganIdStr())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<Integer> organIds = Arrays.stream(employeeDto.getOrganIdStr().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toList());
|
|
|
+ allOrganIds.addAll(organIds);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(allOrganIds)){
|
|
|
+ List<Organization> allOrgans = organizationDao.findOrgans(allOrganIds);
|
|
|
+ for (EmployeeDto employeeDto : dataList) {
|
|
|
+ if(StringUtils.isBlank(employeeDto.getOrganIdStr())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<Integer> organIds = Arrays.stream(employeeDto.getOrganIdStr().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toList());
|
|
|
+ List<Organization> organs = allOrgans.stream().filter(organ -> organIds.contains(organ.getId())).collect(Collectors.toList());
|
|
|
+ List<String> organNames = organs.stream().map(Organization::getName).collect(Collectors.toList());
|
|
|
+ employeeDto.setOrganNameList(organNames);
|
|
|
+ employeeDto.setOrganIdList(organIds.stream().mapToLong(Long::valueOf).boxed().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (count == 0) {
|
|
|
dataList = new ArrayList<>();
|