Commit 7410c7b5 by huangjinxin

fix:分单接口筛选未匹配工程师和工作队

1 parent f146707b
......@@ -70,13 +70,22 @@ public class FendanServiceImpl implements FendanService {
}
//5:单个工程师或团队直接返回
List<OrgTeamEntity> teamList = orgTeamDao.findByTeamIdIn(teamIdList);
Map<String, String> engineerInfoCodeTeamMapAll = teamEngineer.stream().collect(Collectors.toMap(OrgTeamEngineerEntity::getEngineerCode, OrgTeamEngineerEntity::getTeamId));
//实际符合技能要求的工程师和工作队map
Map<String, String> engineerInfoCodeTeamMap = new HashMap<>();
Map<String, String> teamMapReality = new HashMap<>();
List<String> teamIdListReality = new ArrayList<>();
//过滤未匹配到技能的团队形成实际分单工程师和团队
for (EngineerInfoEntity engineerInfoEntity : engineerInfoList) {
engineerInfoEntity.setCreateTime(null);
engineerInfoEntity.setUpdateTime(null);
engineerInfoCodeTeamMap.put(engineerInfoEntity.getEngineerCode(), engineerInfoCodeTeamMapAll.get(engineerInfoEntity.getEngineerCode()));
teamMapReality.put(engineerInfoCodeTeamMapAll.get(engineerInfoEntity.getEngineerCode()), engineerInfoCodeTeamMapAll.get(engineerInfoEntity.getEngineerCode()));
teamIdListReality.add(engineerInfoCodeTeamMapAll.get(engineerInfoEntity.getEngineerCode()));
}
List<OrgTeamEntity> teamList = orgTeamDao.findByTeamIdIn(teamIdList);
Map<String, String> engineerInfoCodeTeamMap = teamEngineer.stream().collect(Collectors.toMap(OrgTeamEngineerEntity::getEngineerCode, OrgTeamEngineerEntity::getTeamId));
Map<String, OrgTeamEntity> teamMap = teamList.stream().collect(Collectors.toMap(OrgTeamEntity::getTeamId, e -> e));
Map<String, OrgTeamEntity> teamMap = teamList.stream().filter(e -> teamMapReality.containsKey(e.getTeamId()))
.collect(Collectors.toMap(OrgTeamEntity::getTeamId, e -> e));
if (engineerInfoList.size() == 1 || teamList.size() == 1) {
OrgTeamEntity orgTeamEntity = engineerInfoList.size() != 1 ? teamList.get(0) :
teamMap.get(engineerInfoCodeTeamMap.get(engineerInfoList.get(0).getEngineerCode()));
......@@ -87,7 +96,7 @@ public class FendanServiceImpl implements FendanService {
}
//5:所有分站/网点只有同一优先级直接返回
List<OrgGroupEntity> orgGroupList = orgGroupDao.findByTeamIdIn(teamIdList);
List<OrgGroupEntity> orgGroupList = orgGroupDao.findByTeamIdIn(teamIdListReality);
Set<Integer> categorySet = orgGroupList.stream().map(e -> e.getCategory()).collect(Collectors.toSet());
if (categorySet.size() == 1) {
for (EngineerInfoEntity engineerInfoEntity : engineerInfoList) {
......@@ -100,7 +109,8 @@ public class FendanServiceImpl implements FendanService {
}
//6:如果筛选出多个分站/网点,多级派单顺序的话进行优先级排序
Map<String, List<OrgTeamEngineerEntity>> orgTeamEngineerInfoCodeMap = teamEngineer.stream().collect(Collectors.groupingBy(OrgTeamEngineerEntity::getTeamId));
Map<String, List<OrgTeamEngineerEntity>> orgTeamEngineerInfoCodeMap = teamEngineer.stream().filter(
e -> engineerInfoCodeTeamMap.containsKey(e.getEngineerCode())).collect(Collectors.groupingBy(OrgTeamEngineerEntity::getTeamId));
Map<String, List<OrgTeamEntity>> orgTeamMap = teamList.stream().collect(Collectors.groupingBy(OrgTeamEntity::getGroupId));
for (OrgGroupEntity orgGroup : orgGroupList) {
for (OrgTeamEntity orgTeamEntity : orgTeamMap.get(orgGroup.getGroupId())) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!