fix:分页查询增加是否有用车行程字段

This commit is contained in:
lulz1 2024-05-22 09:29:37 +08:00
parent 35299e05e6
commit 26f667a827
4 changed files with 17 additions and 44 deletions

View File

@ -44,6 +44,8 @@ public class RouteOrderPageRes {
private String supplierCNName; private String supplierCNName;
@ApiModelProperty("是否为有火车的订单0无1有") @ApiModelProperty("是否为有火车的订单0无1有")
private String ifHaveTrainLeg; private String ifHaveTrainLeg;
@ApiModelProperty("是否为有打车的订单0无1有")
private String ifHaveCarLeg;
@ApiModelProperty("是否能被确认结束, 0不能1能") @ApiModelProperty("是否能被确认结束, 0不能1能")
private String ifCanBeFinished; private String ifCanBeFinished;
} }

View File

@ -169,49 +169,6 @@ public class OrderQuery {
} }
}); });
return new PageResult<>(total, orders); return new PageResult<>(total, orders);
// //根据订单编号事项进行模糊匹配查询
// if (queryData.getOrderNo() != null) {
// Page<RouteOrder> byOrderNoFuzzy = routeRepository.findByOrderNoFuzzy(queryData);
// List<RouteOrder> content = byOrderNoFuzzy.getContent();
// content.forEach(routeOrder -> {
// routeOrder.reloadStatus();
// orderDomainService.queryLocation(routeOrder.getLegItems());
// });
// return new PageResult<>(byOrderNoFuzzy.getTotalElements(),
// content
// .stream()
// .map(OrderQuery::getRouteOrderPageRes)
// .toList());
// }
//
// //根据出差说明进行模糊匹配查询
// if (queryData.getInstructions() != null) {
// Page<RouteOrder> byInstructions = routeRepository.findByInstructions(queryData);
// List<RouteOrder> content = byInstructions.getContent();
// content.forEach(routeOrder -> {
// routeOrder.reloadStatus();
// orderDomainService.queryLocation(routeOrder.getLegItems());
// });
// return new PageResult<>(byInstructions.getTotalElements(),
// content
// .stream()
// .map(OrderQuery::getRouteOrderPageRes)
// .toList());
// }
//
//
// //执行普通分页查询
// PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
// routeOrderPageResult.getRecords().forEach(order -> {
// orderDomainService.queryLocation(order.getLegItems());
// });
// List<RouteOrderPageRes> routeOrderPageRes = routeOrderPageResult
// .getRecords()
// .stream()
// .map(OrderQuery::getRouteOrderPageRes)
// .toList();
// return new PageResult<>(routeOrderPageResult.getTotal(), routeOrderPageRes);
} }
private static List<RouteOrder> temporaryFilter(List<RouteOrder> routeOrders) { private static List<RouteOrder> temporaryFilter(List<RouteOrder> routeOrders) {
@ -301,6 +258,12 @@ public class OrderQuery {
res.setIfHaveTrainLeg("0"); res.setIfHaveTrainLeg("0");
} }
if (routeOrder.checkIfHaveCarLeg()) {
res.setIfHaveCarLeg("1");
} else {
res.setIfHaveCarLeg("0");
}
List<LocationRes> locationRes = legItems List<LocationRes> locationRes = legItems
.stream() .stream()
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))

View File

@ -536,6 +536,14 @@ public class RouteOrder implements Serializable {
.anyMatch(leg -> leg.getLegType().equals(LEG_TYPE_TRAIN)); .anyMatch(leg -> leg.getLegType().equals(LEG_TYPE_TRAIN));
} }
public boolean checkIfHaveCarLeg() {
if (legItems == null || legItems.isEmpty()) {
return false;
}
return legItems.stream()
.anyMatch(leg -> leg.getLegType().equals(LEG_TYPE_TAXI));
}
public RouteOrderDetail mapToOrderDetailVO() { public RouteOrderDetail mapToOrderDetailVO() {
RouteOrderDetail routeOrderDetail = new RouteOrderDetail(); RouteOrderDetail routeOrderDetail = new RouteOrderDetail();
ApproveOrderNo approveOrderNo = this.getApproveOrderNo(); ApproveOrderNo approveOrderNo = this.getApproveOrderNo();

View File

@ -15,7 +15,7 @@ public interface JdbcAmapPolicyRepository extends CrudRepository<AmapPolicy, Lon
@Query(""" @Query("""
select a.* from amap_policy a left join amap_policy_rank ar on a.id = ar.amap_policy_id select a.* from amap_policy a left join amap_policy_rank ar on a.id = ar.amap_policy_id
left join ranks r on ar.rank_id = r.rank_id where r.standard_level = :standardLevel left join ranks_standard_level r on ar.rank_standard_level_id = r.id where r.standard_level = :standardLevel
""") """)
List<AmapPolicy> queryByStandardLevel(@Param("standardLevel") String standardLevel); List<AmapPolicy> queryByStandardLevel(@Param("standardLevel") String standardLevel);
} }