Commit c29d74e4 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 786e0b3d b6579940
...@@ -14,4 +14,6 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -14,4 +14,6 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
List<EngineerInfoEntity> findByGroupId(String groupId); List<EngineerInfoEntity> findByGroupId(String groupId);
List<EngineerInfoEntity> findByGroupIdIn(List<String> groupIds); List<EngineerInfoEntity> findByGroupIdIn(List<String> groupIds);
List<EngineerInfoEntity> findByEngineerCodeIn(List<String> engineerCodes);
} }
...@@ -112,18 +112,28 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -112,18 +112,28 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override @Override
public Result<?> getEngineersByLevel(String levelType, String levelValue) { public Result<?> getEngineersByLevel(String levelType, String levelValue) {
List<EngineerInfoEntity> engineers = null; List<EngineerInfoEntity> engineers = null;
assert "group".equals(levelType) || "branch".equals(levelType) || "cluster".equals(levelType); List<String> groupIds = null;
if ("group".equals(levelType)) { assert "team".equals(levelType) || "group".equals(levelType) || "branch".equals(levelType) || "cluster".equals(levelType);
engineers = engineerInfoDao.findByGroupId(levelType); switch (levelType) {
} else if ("branch".equals(levelType)) { case "team":
List<String> groupIds = orgGroupDao.findAllByBranchId(levelValue).stream() List<String> engineerCodes = orgTeamEngineerDao.findAllByTeamId(levelValue).stream()
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList()); .map(OrgTeamEngineerEntity::getEngineerCode).collect(Collectors.toList());
engineers = engineerInfoDao.findByGroupIdIn(groupIds); engineers = engineerInfoDao.findByEngineerCodeIn(engineerCodes);
} else { break;
// "cluster".equals(levelType) case "group":
List<String> groupIds = orgGroupDao.findAllByClusterId(levelValue).stream() engineers = engineerInfoDao.findByGroupId(levelValue);
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList()); break;
engineers = engineerInfoDao.findByGroupIdIn(groupIds); case "branch":
groupIds = orgGroupDao.findAllByBranchId(levelValue).stream()
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList());
engineers = engineerInfoDao.findByGroupIdIn(groupIds);
break;
default:
// "cluster".equals(levelType)
groupIds = orgGroupDao.findAllByClusterId(levelValue).stream()
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList());
engineers = engineerInfoDao.findByGroupIdIn(groupIds);
break;
} }
List<OrganizationEngineersDTO.Engineer> engineers1 = engineers.stream().map(entity -> { List<OrganizationEngineersDTO.Engineer> engineers1 = engineers.stream().map(entity -> {
return new OrganizationEngineersDTO.Engineer() return new OrganizationEngineersDTO.Engineer()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!