Commit 6e4b5239 by wangli

修改

1 parent c3888f0c
...@@ -46,12 +46,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -46,12 +46,11 @@ public class DispatchServiceImpl implements DispatchService {
private EngineerInfoMPDao engineerInfoMPDao; private EngineerInfoMPDao engineerInfoMPDao;
@Autowired @Autowired
private ProductCategoryMPDao productCategoryMPDao; private SkillInfoMPDao skillInfoMPDao;
@Autowired @Autowired
private CapacityEngineerStatMPDao capacityEngineerStatMPDao; private CapacityEngineerStatMPDao capacityEngineerStatMPDao;
@Transactional @Transactional
@Override @Override
public Result<?> getDispatchOrderList(DispatchOrderListReq reqDTO) { public Result<?> getDispatchOrderList(DispatchOrderListReq reqDTO) {
...@@ -140,8 +139,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -140,8 +139,11 @@ public class DispatchServiceImpl implements DispatchService {
} }
// 获取服务单/工单列表 // 获取服务单/工单列表
Map<String, List<OrderRequest>> orders = this.queryOrderRequestByOrderIds(new ArrayList<>(orderIds)).stream().collect( Map<String, List<OrderRequest>> orders = new HashMap<>();
Collectors.groupingBy(OrderRequest::getOrderId)); if(!orderIds.isEmpty()) {
orders = orderRequestMPDao.selectByOrderIds(new ArrayList<>(orderIds)).stream().collect(
Collectors.groupingBy(OrderRequest::getOrderId));
}
// 获取技术员已指派单列表 // 获取技术员已指派单列表
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>(); List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
...@@ -152,12 +154,14 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -152,12 +154,14 @@ public class DispatchServiceImpl implements DispatchService {
// 技术员已指派的订单列表 // 技术员已指派的订单列表
List<OrderAppointment> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>()); List<OrderAppointment> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>());
for (OrderAppointment r : records) { for (OrderAppointment r : records) {
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
// 获取对应的工单信息 // 获取对应的工单信息
if (ListUtils.isEmpty(orders.get(r.getOrderId()))){
continue;
}
OrderRequest o = orders.get(r.getOrderId()).get(0); OrderRequest o = orders.get(r.getOrderId()).get(0);
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
item.setOrderId(r.getOrderId()); item.setOrderId(r.getOrderId());
item.setCategory(String.format("%s-%s", o.getType(), o.getBrand())); item.setCategory(String.format("%s-%s", o.getType(), o.getBrand()));
item.setSkill(o.getSkill()); item.setSkill(o.getSkill());
...@@ -217,7 +221,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -217,7 +221,7 @@ public class DispatchServiceImpl implements DispatchService {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
List<OrderRequest> orders = this.queryOrderRequestByOrderIds(orderIds); List<OrderRequest> orders = orderRequestMPDao.selectByOrderIds(orderIds);
if (orders.isEmpty()) { if (orders.isEmpty()) {
throw new BusinessException("订单号错误"); throw new BusinessException("订单号错误");
} }
...@@ -297,16 +301,6 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -297,16 +301,6 @@ public class DispatchServiceImpl implements DispatchService {
return orderRequestMPDao.selectList(lqw); return orderRequestMPDao.selectList(lqw);
} }
private List<OrderRequest> queryOrderRequestByOrderIds(List<String> orderIds) {
List<OrderRequest> orders = new ArrayList<>();
if (orderIds.isEmpty()) {
return orders;
}
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderRequest::getOrderId, orderIds);
return orderRequestMPDao.selectList(lqw);
}
private Map<String, List<OrderAppointment>> queryEngineerOrders(List<String> engineerCodes, String date) { private Map<String, List<OrderAppointment>> queryEngineerOrders(List<String> engineerCodes, String date) {
// 获取工程师服务单列表 // 获取工程师服务单列表
...@@ -360,8 +354,8 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -360,8 +354,8 @@ public class DispatchServiceImpl implements DispatchService {
private HashMap<String, Integer> querySkillTakeTime() { private HashMap<String, Integer> querySkillTakeTime() {
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
List<ProductCategory> records = productCategoryMPDao.selectList(null); List<SkillInfo> records = skillInfoMPDao.selectList(null);
for (ProductCategory r : records) { for (SkillInfo r : records) {
String key = String.format("%s%s%sd", r.getBrand(), r.getType(), r.getSkill()); String key = String.format("%s%s%sd", r.getBrand(), r.getType(), r.getSkill());
map.put(key, r.getTakeTime()); map.put(key, r.getTakeTime());
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!