Commit 29e8ef60 by wangli

修改

1 parent 0121159a
package com.alibaba.cloud.integration.order.service.impl; package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.OrderAppointmentMPDao; import com.alibaba.cloud.integration.order.dao.*;
import com.alibaba.cloud.integration.order.dao.OrderRequestMPDao;
import com.alibaba.cloud.integration.order.dao.OrgTeamEngineerMPDao;
import com.alibaba.cloud.integration.order.dao.OrgTeamMPDao;
import com.alibaba.cloud.integration.order.dto.ScheduleOverviewResp; import com.alibaba.cloud.integration.order.dto.ScheduleOverviewResp;
import com.alibaba.cloud.integration.order.entity.OrderAppointment; import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.entity.OrderRequest;
import com.alibaba.cloud.integration.order.entity.OrgTeam;
import com.alibaba.cloud.integration.order.entity.OrgTeamEngineer;
import com.alibaba.cloud.integration.order.service.ScheduleService; import com.alibaba.cloud.integration.order.service.ScheduleService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -38,6 +32,9 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -38,6 +32,9 @@ public class ScheduleServiceImpl implements ScheduleService {
@Autowired @Autowired
private OrderAppointmentMPDao orderAppointmentMPDao; private OrderAppointmentMPDao orderAppointmentMPDao;
@Autowired
private EngineerInfoMPDao engineerInfoMPDao;
@Override @Override
public Result<?> getScheduleOverview(long page, long size, String date, String levelType, List<String> levelIds) { public Result<?> getScheduleOverview(long page, long size, String date, String levelType, List<String> levelIds) {
...@@ -68,6 +65,10 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -68,6 +65,10 @@ public class ScheduleServiceImpl implements ScheduleService {
// 获取team技术员列表 // 获取team技术员列表
List<OrgTeamEngineer> teamEngineers = this.queryOrgTeamEngineers(t.getTeamId()); List<OrgTeamEngineer> teamEngineers = this.queryOrgTeamEngineers(t.getTeamId());
// 获取技术员列表
List<EngineerInfo> engineerInfoList = this.queryEngineerInfoByGroupId(t.getGroupId());
Map<String, List<EngineerInfo>> engineers = engineerInfoList.stream().collect(Collectors.groupingBy(EngineerInfo::getEngineerCode));
// 获取技术员对应的订单 // 获取技术员对应的订单
List<String> orderRequestIds = orders.stream().map(OrderRequest::getOrderId).collect(Collectors.toList()); List<String> orderRequestIds = orders.stream().map(OrderRequest::getOrderId).collect(Collectors.toList());
List<OrderAppointment> orderAppointments = this.queryOrderAppointments(orderRequestIds, date); List<OrderAppointment> orderAppointments = this.queryOrderAppointments(orderRequestIds, date);
...@@ -85,18 +86,25 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -85,18 +86,25 @@ public class ScheduleServiceImpl implements ScheduleService {
orders2.add(o); orders2.add(o);
} }
} }
child.setName("");
// 设置技术员姓名
List<EngineerInfo> es = engineers.get(engineerCode);
if (es == null || es.isEmpty()) {
child.setName(engineerCode);
} else {
child.setName(es.get(0).getName());
}
child.setValue(engineerCode); child.setValue(engineerCode);
child.setLevel("engineer"); child.setLevel("engineer");
child.setOrder(this.getTeamOrderSum(orders2)); child.setOrder(this.getTeamOrderSum(orders2));
child.setOrderDesc(Integer.toString(orders2.size())); child.setOrderDesc(Integer.toString(orders2.size()));
child.setDistanceDes(""); child.setDistanceDesc("");
children.add(child); children.add(child);
} }
team.setChildren(children); team.setChildren(children);
team.setOrderDesc(String.format("人均:%d", orders.size() / teamEngineers.size())); team.setOrderDesc(String.format("人均:%d", orders.size() / teamEngineers.size()));
team.setDistanceDes(""); team.setDistanceDesc("");
teams.add(team); teams.add(team);
} }
...@@ -153,6 +161,12 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -153,6 +161,12 @@ public class ScheduleServiceImpl implements ScheduleService {
return orderAppointmentMPDao.selectList(lqw); return orderAppointmentMPDao.selectList(lqw);
} }
private List<EngineerInfo> queryEngineerInfoByGroupId(String groupId) {
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerInfo::getGroupId, groupId);
return engineerInfoMPDao.selectList(lqw);
}
private ScheduleOverviewResp.OrderSum getTeamOrderSum(List<OrderRequest> orders) { private ScheduleOverviewResp.OrderSum getTeamOrderSum(List<OrderRequest> orders) {
ScheduleOverviewResp.OrderSum s = new ScheduleOverviewResp.OrderSum(); ScheduleOverviewResp.OrderSum s = new ScheduleOverviewResp.OrderSum();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!