订单分页查询增加新参数
This commit is contained in:
parent
44c7cb1845
commit
ec9a797ad2
|
@ -58,16 +58,17 @@ public class OrderQuery {
|
||||||
//执行筛选分页查询
|
//执行筛选分页查询
|
||||||
List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes();
|
List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes();
|
||||||
List<Integer> legTypes = queryData.getLegTypes();
|
List<Integer> legTypes = queryData.getLegTypes();
|
||||||
if (!approvalStatusCodes.isEmpty() || !legTypes.isEmpty()) {
|
if ((approvalStatusCodes != null && !approvalStatusCodes.isEmpty()) || (legTypes != null && !legTypes.isEmpty())) {
|
||||||
Integer pageNum = queryData.getPageNum();
|
Integer pageNum = queryData.getPageNum();
|
||||||
Integer pageSize = queryData.getPageSize();
|
Integer pageSize = queryData.getPageSize();
|
||||||
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull();
|
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull();
|
||||||
if (!approvalStatusCodes.isEmpty()) {
|
routeOrders.forEach(RouteOrder::reloadStatus);
|
||||||
|
if (approvalStatusCodes != null && !approvalStatusCodes.isEmpty()) {
|
||||||
routeOrders = routeOrders.stream()
|
routeOrders = routeOrders.stream()
|
||||||
.filter(routeOrder -> approvalStatusCodes.contains(routeOrder.getApprovalStatusCode()))
|
.filter(routeOrder -> approvalStatusCodes.contains(routeOrder.getApprovalStatusCode()))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
if (!legTypes.isEmpty()) {
|
if (legTypes != null && !legTypes.isEmpty()) {
|
||||||
routeOrders = routeOrders.stream()
|
routeOrders = routeOrders.stream()
|
||||||
.filter(routeOrder -> {
|
.filter(routeOrder -> {
|
||||||
List<Integer> list = new ArrayList<>(routeOrder.getLegItems().stream().map(Leg::getLegType).toList());
|
List<Integer> list = new ArrayList<>(routeOrder.getLegItems().stream().map(Leg::getLegType).toList());
|
||||||
|
@ -85,16 +86,32 @@ public class OrderQuery {
|
||||||
return new PageResult<>(total, orders);
|
return new PageResult<>(total, orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//根据订单编号事项进行模糊匹配查询
|
||||||
if (queryData.getOrderNo() != null) {
|
if (queryData.getOrderNo() != null) {
|
||||||
Page<RouteOrder> byOrderNoFuzzy = routeRepository.findByOrderNoFuzzy(queryData);
|
Page<RouteOrder> byOrderNoFuzzy = routeRepository.findByOrderNoFuzzy(queryData);
|
||||||
|
List<RouteOrder> content = byOrderNoFuzzy.getContent();
|
||||||
|
content.forEach(RouteOrder::reloadStatus);
|
||||||
return new PageResult<>(byOrderNoFuzzy.getTotalElements(),
|
return new PageResult<>(byOrderNoFuzzy.getTotalElements(),
|
||||||
byOrderNoFuzzy
|
content
|
||||||
.getContent()
|
|
||||||
.stream()
|
.stream()
|
||||||
.map(OrderQuery::getRouteOrderPageRes)
|
.map(OrderQuery::getRouteOrderPageRes)
|
||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//根据出差说明进行模糊匹配查询
|
||||||
|
if(queryData.getInstructions() != null){
|
||||||
|
Page<RouteOrder> byInstructions = routeRepository.findByInstructions(queryData);
|
||||||
|
List<RouteOrder> content = byInstructions.getContent();
|
||||||
|
content.forEach(RouteOrder::reloadStatus);
|
||||||
|
content.forEach(RouteOrder::reloadStatus);
|
||||||
|
return new PageResult<>(byInstructions.getTotalElements(),
|
||||||
|
content
|
||||||
|
.stream()
|
||||||
|
.map(OrderQuery::getRouteOrderPageRes)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//执行普通分页查询
|
//执行普通分页查询
|
||||||
PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
|
PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
|
||||||
|
|
|
@ -16,9 +16,12 @@ public interface RouteRepository {
|
||||||
|
|
||||||
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RouteOrder findByOrderNo(String orderNo);
|
RouteOrder findByOrderNo(String orderNo);
|
||||||
Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData);
|
Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData);
|
||||||
|
|
||||||
|
Page<RouteOrder> findByInstructions(OrderQueryData orderQueryData);
|
||||||
|
|
||||||
RouteOrder save(RouteOrder routeOrder);
|
RouteOrder save(RouteOrder routeOrder);
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,5 @@ public class OrderQueryData extends BaseQuery {
|
||||||
private List<Integer> approvalStatusCodes;
|
private List<Integer> approvalStatusCodes;
|
||||||
private List<Integer> legTypes;
|
private List<Integer> legTypes;
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
private String instructions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,15 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
, orderQueryData.getOrderNo(), sort);
|
, orderQueryData.getOrderNo(), sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<RouteOrder> findByInstructions(OrderQueryData orderQueryData) {
|
||||||
|
PageRequest sort = PageRequest
|
||||||
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_InstructionsContaining(currentUser.getUserId().toString(),
|
||||||
|
orderQueryData.getInstructions(),sort);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder save(RouteOrder routeOrder) {
|
public RouteOrder save(RouteOrder routeOrder) {
|
||||||
return jdbcRouteRepository.save(routeOrder);
|
return jdbcRouteRepository.save(routeOrder);
|
||||||
|
|
|
@ -18,6 +18,8 @@ public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
||||||
|
|
||||||
RouteOrder findByApproveOrderNo_FakeOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_fakeOrderNo, String sysCode);
|
RouteOrder findByApproveOrderNo_FakeOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_fakeOrderNo, String sysCode);
|
||||||
|
|
||||||
|
Page<RouteOrder> findByCreateUserAndApproveOrderNo_InstructionsContaining(String createUser, String approveOrderNo_instructions, Pageable pageable);
|
||||||
|
|
||||||
RouteOrder findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_actualOrderNo, String approveOrderNo_sysCode);
|
RouteOrder findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_actualOrderNo, String approveOrderNo_sysCode);
|
||||||
|
|
||||||
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
||||||
|
|
Loading…
Reference in New Issue