Commit 9f7a0b17 by wangli

修改

1 parent 61500134
......@@ -40,6 +40,9 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
@Autowired
private OrgGroupMPDao orgGroupMPDao;
@Autowired
private OrderEventMPDao orderEventMPDao;
@Transactional
@Override
public Result<?> getEngineerTimelines(String engineerCode, String date){
......@@ -49,16 +52,14 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
// 工程師信息
EngineerInfo engineerInfo = engineerInfoMPDao.getByEngineerCode(engineerCode);
// 获取工程师已完成的timeline数据
List<EngineerTimeline> timelines = this.engineerTimelines(engineerCode, date);
// 获取工程师date日的订单数据
List<OrderAppointment> orders = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineerCode, localDate);
// 获取工程师已完成的timeline数据
List<String> orderIds = orders.stream().map(OrderAppointment::getOrderId).collect(Collectors.toList());
List<OrderEvent> timelines = this.engineerTimelines(orderIds, date);
// 获取客户地址
List<String> orderIds = new ArrayList<>();
for(OrderAppointment o: orders) {
orderIds.add(o.getOrderId());
}
HashMap<String, String> orderLocations = this.orderRequestsLocation(orderIds);
// 获取配送站地址
......@@ -74,20 +75,19 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
return Result.success(res);
}
private List<EngineerTimeline> engineerTimelines(String engineerCode, String date){
private List<OrderEvent> engineerTimelines(List<String> orderIds, String date){
// 获取工程师timeline
List<String> events = Stream.of("分站取还配件", "已出发", "加单").collect(Collectors.toList());
LambdaQueryWrapper<EngineerTimeline> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerTimeline::getEngineerCode, engineerCode);
lqw.ge(EngineerTimeline::getHappen, date+" 00:00:00");
lqw.le(EngineerTimeline::getHappen, date + " 23:59:59");
lqw.in(EngineerTimeline::getEvent, events);
return engineerTimelineMPDao.selectList(lqw);
LambdaQueryWrapper<OrderEvent> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderEvent::getOrderId, orderIds);
lqw.ge(OrderEvent::getHappen, date+" 00:00:00");
lqw.le(OrderEvent::getHappen, date + " 23:59:59");
lqw.in(OrderEvent::getEvent, events);
return orderEventMPDao.selectList(lqw);
}
private HashMap<String, String> orderRequestsLocation(List<String> orderIds) {
// 获取客户地址location
HashMap<String, String> map = new HashMap<>();
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderRequest::getOrderId, orderIds);
......@@ -123,14 +123,14 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
}
private List<EnginnerTimelineResp.DynamicItem> packItems(List<EngineerTimeline> timelines, List<OrderAppointment> orders, HashMap<String, String> locations, String warehouseLocation) {
private List<EnginnerTimelineResp.DynamicItem> packItems(List<OrderEvent> timelines, List<OrderAppointment> orders, HashMap<String, String> locations, String warehouseLocation) {
int index = 1;
String order_id, title, type, text, location;
List<EnginnerTimelineResp.DynamicItem> items = new ArrayList<>();
Set<String> s = new HashSet<>();
for (EngineerTimeline t: timelines){
for (OrderEvent t: timelines){
EnginnerTimelineResp.DynamicItem item = new EnginnerTimelineResp.DynamicItem();
if (t.getEvent().equals("分站取还配件")) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!