Commit bc31c720 by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents 4a0a8788 0811b007
...@@ -21,18 +21,12 @@ import java.util.stream.Stream; ...@@ -21,18 +21,12 @@ import java.util.stream.Stream;
public class EngineerTimelineServiceImpl implements EngineerTimelineService { public class EngineerTimelineServiceImpl implements EngineerTimelineService {
@Autowired @Autowired
private EngineerTimelineMPDao engineerTimelineMPDao; private OrderInfoMPDao orderInfoMPDao;
@Autowired
private OrderAppointmentMPDao orderAppointmentMPDao;
@Autowired @Autowired
private EngineerInfoMPDao engineerInfoMPDao; private EngineerInfoMPDao engineerInfoMPDao;
@Autowired @Autowired
private OrderRequestMPDao orderRequestMPDao;
@Autowired
private WarehouseInfoMPDao warehouseInfoMPDao; private WarehouseInfoMPDao warehouseInfoMPDao;
@Autowired @Autowired
...@@ -51,14 +45,14 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -51,14 +45,14 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
EngineerInfo engineerInfo = engineerInfoMPDao.getByEngineerCode(engineerCode); EngineerInfo engineerInfo = engineerInfoMPDao.getByEngineerCode(engineerCode);
// 获取工程师date日的订单数据 // 获取工程师date日的订单数据
List<OrderAppointment> orders = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineerCode, localDate); List<OrderInfo> orders = this.selectEngineerOrders(engineerCode, localDate);
// 获取工程师已完成的timeline数据 // 获取工程师已完成的timeline数据
List<String> orderIds = orders.stream().map(OrderAppointment::getOrderId).collect(Collectors.toList()); List<String> orderIds = orders.stream().map(OrderInfo::getOrderId).collect(Collectors.toList());
List<OrderEvent> timelines = this.engineerTimelines(orderIds, date); List<OrderEvent> timelines = this.engineerTimelines(orderIds, date);
// 获取客户地址 // 获取客户地址
HashMap<String, String> orderLocations = this.orderRequestsLocation(orderIds); HashMap<String, String> orderLocations = this.orderRequestsLocation(orders);
// 获取配送站地址 // 获取配送站地址
String branchId = this.getEngineerBranchId(engineerCode); String branchId = this.getEngineerBranchId(engineerCode);
...@@ -73,6 +67,15 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -73,6 +67,15 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
return Result.success(res); return Result.success(res);
} }
private List<OrderInfo> selectEngineerOrders(String engineerCode, LocalDate dt){
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getDt, dt);
lqw.eq(OrderInfo::getEngineerCode, engineerCode);
lqw.ne(OrderInfo::getAppointmentStatus, "INIT");
lqw.ne(OrderInfo::getOrderStatus, "CANCEL");
return orderInfoMPDao.selectList(lqw);
}
private List<OrderEvent> engineerTimelines(List<String> orderIds, String date){ private List<OrderEvent> engineerTimelines(List<String> orderIds, String date){
// 获取工程师timeline // 获取工程师timeline
List<String> events = Stream.of("分站取还配件", "已出发", "加单").collect(Collectors.toList()); List<String> events = Stream.of("分站取还配件", "已出发", "加单").collect(Collectors.toList());
...@@ -84,13 +87,10 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -84,13 +87,10 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
return orderEventMPDao.selectList(lqw); return orderEventMPDao.selectList(lqw);
} }
private HashMap<String, String> orderRequestsLocation(List<String> orderIds) { private HashMap<String, String> orderRequestsLocation(List<OrderInfo> orders) {
// 获取客户地址location // 获取客户地址location
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>(); for(OrderInfo o: orders){
lqw.in(OrderRequest::getOrderId, orderIds);
List<OrderRequest> orders = orderRequestMPDao.selectList(lqw);
for(OrderRequest o: orders){
map.put(o.getOrderId(), String.format("%s,%s", o.getX(), o.getY())); map.put(o.getOrderId(), String.format("%s,%s", o.getX(), o.getY()));
} }
return map; return map;
...@@ -122,7 +122,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -122,7 +122,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
} }
private List<EngineerTimelineResp.DynamicItem> packItems(List<OrderEvent> timelines, List<OrderAppointment> orders, HashMap<String, String> locations, String warehouseLocation) { private List<EngineerTimelineResp.DynamicItem> packItems(List<OrderEvent> timelines, List<OrderInfo> orders, HashMap<String, String> locations, String warehouseLocation) {
int index = 0; int index = 0;
String order_id, title, type, text, location; String order_id, title, type, text, location;
...@@ -143,11 +143,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -143,11 +143,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
type = "other"; type = "other";
location = locations.get(t.getOrderId()); location = locations.get(t.getOrderId());
} else { } else {
index += 1; continue;
title = String.format("第%d单出发", index);
text = String.format("%d", index);
type = "order";
location = locations.get(t.getOrderId());
} }
item.setTitle(title); item.setTitle(title);
item.setTime(TimeUtils.IsoTimestamp2DateTime(t.getHappen())); item.setTime(TimeUtils.IsoTimestamp2DateTime(t.getHappen()));
...@@ -161,15 +157,16 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -161,15 +157,16 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
s.add(t.getOrderId() + t.getSuborderId()); s.add(t.getOrderId() + t.getSuborderId());
} }
for(OrderAppointment o: orders){ List<OrderInfo> records = orders.stream().sorted(Comparator.comparing(OrderInfo::getPlanStartTime)).collect(Collectors.toList());
order_id = o.getOrderId() + o.getSuborderId(); for(OrderInfo o: records){
order_id = o.getOrderId() + o.getSubId();
if (s.contains(order_id)) { if (s.contains(order_id)) {
continue; continue;
} }
index += 1; index += 1;
EngineerTimelineResp.DynamicItem item = new EngineerTimelineResp.DynamicItem(); EngineerTimelineResp.DynamicItem item = new EngineerTimelineResp.DynamicItem();
item.setTitle(String.format("第%d单出发", index)); item.setTitle(String.format("第%d单出发", index));
item.setTime(TimeUtils.IsoTimestamp2DateTime(o.getExpectStartTime())); item.setTime(TimeUtils.IsoTimestamp2DateTime(o.getPlanStartTime()));
item.setStatus(0); item.setStatus(0);
item.setText(String.format("%d", index)); item.setText(String.format("%d", index));
item.setLocation(locations.get(o.getOrderId())); item.setLocation(locations.get(o.getOrderId()));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!