Commit b291733d by wangli

新增teamIds筛选

1 parent 11f365bc
...@@ -126,20 +126,18 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -126,20 +126,18 @@ public class DispatchServiceImpl implements DispatchService {
public Result<?> getDispatchEngineerOrderList(DispatchEngineerOrderListReq reqDTO) throws BusinessException { public Result<?> getDispatchEngineerOrderList(DispatchEngineerOrderListReq reqDTO) throws BusinessException {
// 派工台技术员预约单列表 // 派工台技术员预约单列表
// 获取技能耗时
HashMap<String, Integer> skillTakeTime = this.querySkillTakeTime();
// 获取技能信息 // 获取技能信息
HashMap<String, SkillInfo> skillInfo = this.querySkillInfo(); HashMap<String, SkillInfo> skillInfo = this.querySkillInfo();
// 获取groupIds // 获取groupIds
List<String> groupIds = this.queryOrgGroupIds(reqDTO.getLevelType(), reqDTO.getLevelValue(), reqDTO.getBranchIds(), List<String> teamIds = this.queryOrgTeamIds(reqDTO.getLevelType(), reqDTO.getLevelValue(), reqDTO.getBranchIds(),
reqDTO.getGroupIds(), reqDTO.getTeamIds()); reqDTO.getGroupIds(), reqDTO.getTeamIds());
if (groupIds.isEmpty()) { if (teamIds.isEmpty()) {
throw new BusinessException("大区/分部/小组组织结构配置可能错误或缺失,请联系管理员/研发"); throw new BusinessException("大区/分部/小组组织结构配置可能错误或缺失,请联系管理员/研发");
} }
// 获取engineer列表 // 获取engineer列表
List<EngineerInfo> engineers = this.queryEngineers(groupIds, reqDTO.getEngineerCodes(), reqDTO.getKey()); List<EngineerInfo> engineers = this.queryEngineers(teamIds, reqDTO.getEngineerCodes(), reqDTO.getKey());
if (engineers.isEmpty()) { if (engineers.isEmpty()) {
// 该group下没有技术员,返回空 // 该group下没有技术员,返回空
DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp(); DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp();
...@@ -398,13 +396,16 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -398,13 +396,16 @@ public class DispatchServiceImpl implements DispatchService {
} }
private List<EngineerInfo> queryEngineers(List<String> groupIds, List<String> engineerCodes, String key) { private List<EngineerInfo> queryEngineers(List<String> teamIds, List<String> engineerCodes, String key) {
// 通过groupIds获取技术员列表 // 通过groupIds获取技术员列表
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.in(EngineerInfo::getGroupId, groupIds);
lqw.eq(EngineerInfo::getBeanStatus, 1); lqw.eq(EngineerInfo::getBeanStatus, 1);
lqw.in(ListUtils.isNotEmpty(engineerCodes), EngineerInfo::getEngineerCode, engineerCodes); lqw.in(ListUtils.isNotEmpty(engineerCodes), EngineerInfo::getEngineerCode, engineerCodes);
String inTeamIds = teamIds.stream().map(Object::toString).collect(Collectors.joining(","));
String sql = String.format("select 1 from org_team_engineer ot where ot.engineer_code = engineer_info.engineer_code and ot.team_id in (%s)", inTeamIds);
lqw.exists(sql);
if (StringUtils.isNotEmpty(key)) { if (StringUtils.isNotEmpty(key)) {
lqw.and(w -> lqw.and(w ->
w.like(EngineerInfo::getPhone, key) w.like(EngineerInfo::getPhone, key)
...@@ -418,7 +419,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -418,7 +419,7 @@ public class DispatchServiceImpl implements DispatchService {
return engineerInfoMPDao.selectList(lqw); return engineerInfoMPDao.selectList(lqw);
} }
private List<String> queryOrgGroupIds(String levelType, String levelIds, List<String> branchIds, List<String> groupIds, List<String> teamIds) { private List<String> queryOrgTeamIds(String levelType, String levelIds, List<String> branchIds, List<String> groupIds, List<String> teamIds) {
LambdaQueryWrapper<OrgTeam> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgTeam> lqw = new LambdaQueryWrapper<>();
lqw.eq(levelType.equals("cluster"), OrgTeam::getClusterId, levelIds); lqw.eq(levelType.equals("cluster"), OrgTeam::getClusterId, levelIds);
lqw.eq(levelType.equals("branch"), OrgTeam::getBranchId, levelIds); lqw.eq(levelType.equals("branch"), OrgTeam::getBranchId, levelIds);
...@@ -427,8 +428,8 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -427,8 +428,8 @@ public class DispatchServiceImpl implements DispatchService {
lqw.in(ListUtils.isNotEmpty(groupIds), OrgTeam::getGroupId, groupIds); lqw.in(ListUtils.isNotEmpty(groupIds), OrgTeam::getGroupId, groupIds);
lqw.in(ListUtils.isNotEmpty(teamIds), OrgTeam::getTeamId, teamIds); lqw.in(ListUtils.isNotEmpty(teamIds), OrgTeam::getTeamId, teamIds);
List<OrgTeam> groups = orgTeamMPDao.selectList(lqw); List<OrgTeam> teams = orgTeamMPDao.selectList(lqw);
return groups.stream().map(OrgTeam::getGroupId).collect(Collectors.toList()); return teams.stream().map(OrgTeam::getTeamId).collect(Collectors.toList());
} }
private HashMap<String, Integer> querySkillTakeTime() { private HashMap<String, Integer> querySkillTakeTime() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!