【update】消费明细查询条件修改

This commit is contained in:
nixj 2024-05-27 14:47:22 +08:00
parent 1c73039ac7
commit 0bf83c362c
8 changed files with 62 additions and 5 deletions

View File

@ -28,4 +28,6 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType); List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType);
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo); List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
List<OrderDetail> findAllByRouteIdIn(Collection<Long> routeIds);
} }

View File

@ -6,6 +6,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -52,4 +53,10 @@ select * from route_order r1 left join route_custom_extension_field r2 on r1.rou
List<RouteOrder> findByField(); List<RouteOrder> findByField();
List<RouteOrder> findByRouteOrderNoIn(Collection<String> routeOrderNo); List<RouteOrder> findByRouteOrderNoIn(Collection<String> routeOrderNo);
List<RouteOrder> findAllByApproveOrderNo_ActualOrderNoContaining(String approveOrderNo_actualOrderNo);
@Query("select od.order_no from route_order ro,order_detail od where ro.route_id=od.route_id and ro.actual_order_no like :actualOrderNo")
List<String> findByActualOrderNo(@Param("actualOrderNo") String actualOrderNo);
} }

View File

@ -15,5 +15,5 @@ public class ConsumptionDetailQuery extends BaseQuery{
*/ */
private Integer productType; private Integer productType;
private String userName=""; private String userName="";
private String orderNo=""; private String actualOrderNo=""; //申请单号
} }

View File

@ -1,13 +1,20 @@
package com.chint.manage.mapper; package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.CarOrderDetail; import com.chint.domain.aggregates.order.CarOrderDetail;
import com.chint.domain.aggregates.order.HotelOrderDetail;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> { public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> {
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoIn(String userName, List<String> orderNo, Pageable pageable);
Page<CarOrderDetail> findAllByUserNameContains(String userName, Pageable pageable);
} }

View File

@ -1,13 +1,20 @@
package com.chint.manage.mapper; package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.FlightOrderDetail; import com.chint.domain.aggregates.order.FlightOrderDetail;
import com.chint.domain.aggregates.order.TrainOrderDetail;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> { public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> {
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoIn(String userName, List<String> orderNo, Pageable pageable);
Page<FlightOrderDetail> findAllByUserNameContains(String userName, Pageable pageable);
} }

View File

@ -1,5 +1,6 @@
package com.chint.manage.mapper; package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.FlightOrderDetail;
import com.chint.domain.aggregates.order.HotelOrderDetail; import com.chint.domain.aggregates.order.HotelOrderDetail;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -7,8 +8,14 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> { public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> {
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoIn(String userName, List<String> orderNo, Pageable pageable);
Page<HotelOrderDetail> findAllByBookingNameContains(String userName, Pageable pageable);
} }

View File

@ -6,8 +6,14 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> { public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> {
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoIn(String userName, List<String> orderNo, Pageable pageable);
Page<TrainOrderDetail> findAllByUserNameContains(String userName, Pageable pageable);
} }

View File

@ -1,6 +1,8 @@
package com.chint.manage.mapper.impl; package com.chint.manage.mapper.impl;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.dto.ItineraryPageDto; import com.chint.manage.entity.dto.ItineraryPageDto;
import com.chint.manage.entity.query.ConsumptionDetailQuery; import com.chint.manage.entity.query.ConsumptionDetailQuery;
@ -41,6 +43,10 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository; private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository;
@Autowired @Autowired
private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository; private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository;
@Autowired
private JdbcRouteRepository jdbcRouteRepository;
@Autowired
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
@Override @Override
@ -78,11 +84,26 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
PageRequest pageRequest = PageRequest PageRequest pageRequest = PageRequest
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList()); Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
//申请单查询
if (!dto.getActualOrderNo().isEmpty()){
List<String> orderNos=jdbcRouteRepository.findByActualOrderNo("%" + dto.getActualOrderNo() + "%");
if (orderNos.isEmpty()){
return new PageResult<BaseExcel>(0,new ArrayList<>());
}
switch (dto.getProductType()) { switch (dto.getProductType()) {
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest));
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest));
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest));
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest));
}
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
}
switch (dto.getProductType()) {
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContains(dto.getUserName(),pageRequest));
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContains(dto.getUserName(),pageRequest));
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContains(dto.getUserName(),pageRequest));
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContains(dto.getUserName(),pageRequest));
} }
return PageResult.totalPageNum(data.getTotalElements(), data.getContent()); return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
} }