Commit 866b9a58 by huangjinxin

fix:插单优化

1 parent 06ca3783
......@@ -564,10 +564,12 @@ public class OrderInfoServiceImpl implements OrderInfoService {
if (!handleLeaveTimeResult.getCode().equals(ResultEnum.SUCCESS.getCode())) {
return Result.failed(insertOrder);
}
//第一个没有在途时长
LocalDateTime planStartTime = (LocalDateTime) handleLeaveTimeResult.getResult();
//第一个没有在途时长
if (i == 0) {
insertOrder.setArriveElapsed(0);
insertOrder.setArriveDistance(0);
}
insertOrder.setTakeTime(skillInfo.getTakeTime());
insertOrder.setPlanStartTime(planStartTime);
insertOrder.setPlanEndTime(planStartTime.plusMinutes(skillInfo.getTakeTime()));
......@@ -595,18 +597,14 @@ public class OrderInfoServiceImpl implements OrderInfoService {
LocalDateTime planStartTime = (LocalDateTime) handleLeaveTimeResult.getResult();
if (orderSegment.getEnd().plusMinutes(roadTime).compareTo(planStartTime) <= 0) {
//下一单为待插入订单且为最后一单直接返回
insertOrder.setArriveElapsed(roadTime);
insertOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis()).intValue());
if (i == orderSegments.size() - 2) {
insertOrder.setTakeTime(skillInfo.getTakeTime());
insertOrder.setPlanStartTime(planStartTime);
insertOrder.setPlanEndTime(planStartTime.plusMinutes(skillInfo.getTakeTime()));
insertOrder.setArriveElapsed(roadTime);
insertOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis()).intValue());
return Result.success(insertOrder);
}
OrderInfoEntity nestOrder = orderInfoDao.getByOrderId(nestOrderSegment.getOrderId());
nestOrder.setArriveElapsed(roadTime);
nestOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis()).intValue());
orderInfoDao.save(nestOrder);
continue;
}
insertOrder.setTakeTime(skillInfo.getTakeTime());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!