我的订单查询,增加筛选未出行参数
This commit is contained in:
parent
7629e1f8ab
commit
304bc330df
|
@ -8,5 +8,7 @@ import java.util.List;
|
|||
@Data
|
||||
public class OrderDetailQueryParam extends BaseQuery {
|
||||
private Long orderId;
|
||||
private Long routeId;
|
||||
private Integer ifStart; //0未出行,1已出行
|
||||
private List<Integer> productTypes;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.chint.infrastructure.util.PageResult;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -30,6 +31,7 @@ public class OrderDetailQuery {
|
|||
public PageResult<OrderDetailRes> orderDetailPageQuery(OrderDetailQueryParam orderDetailQueryParam) {
|
||||
Integer pageNum = orderDetailQueryParam.getPageNum();
|
||||
Integer pageSize = orderDetailQueryParam.getPageSize();
|
||||
Integer ifStart = orderDetailQueryParam.getIfStart();
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
Stream<OrderDetail> details = routeRepository.findByEmployeeNo(currentUser.getEmployeeNo())
|
||||
.stream()
|
||||
|
@ -39,6 +41,15 @@ public class OrderDetailQuery {
|
|||
if (productTypes != null) {
|
||||
details = details.filter(it -> productTypes.contains(it.getProductType()));
|
||||
}
|
||||
|
||||
if(ifStart != null && ifStart.equals(0)){
|
||||
details = details.filter(it->it.getStartTime().isAfter(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
if(ifStart != null && ifStart.equals(1)){
|
||||
details = details.filter(it->it.getStartTime().isBefore(LocalDateTime.now()));
|
||||
}
|
||||
|
||||
List<OrderDetail> res = details.toList();
|
||||
Integer total = res.size();
|
||||
List<OrderDetailRes> OrderDetailResList = res.stream()
|
||||
|
|
|
@ -58,9 +58,13 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
|
||||
Location byName = locationRepository.findByCityNameAndLevelThree(hotelOrderInfoEntity.getCityName()).get(0);
|
||||
|
||||
String currency = hotelOrderInfoEntity.getCurrency();
|
||||
if(currency == null){
|
||||
currency = CurrencyType.RENMINBI.getCode();
|
||||
}
|
||||
return builder.productType(LegConstant.LEG_TYPE_HOTEL)
|
||||
.hotelOrderDetailData(hotelOrderInfoEntity)
|
||||
.currencyCode(hotelOrderInfoEntity.getCurrency())
|
||||
.currencyCode(currency)
|
||||
.orderTime(hotelOrderInfoEntity.getOrderDate())
|
||||
.startTime(hotelOrderInfoEntity.getStartTime())
|
||||
.endTime(hotelOrderInfoEntity.getEndTime())
|
||||
|
@ -81,9 +85,14 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
FlightInfo flightInfo = flightOrderInfo.getFlightInfo().get(0);
|
||||
Location departCityName = locationRepository.findByCityNameAndLevelThree(flightInfo.getDCityName()).get(0);
|
||||
Location arriveCityName = locationRepository.findByCityNameAndLevelThree(flightInfo.getACityName()).get(0);
|
||||
|
||||
String currency = flightOrderInfo.getBasicInfo().getCurrency();
|
||||
if(currency == null){
|
||||
currency = CurrencyType.RENMINBI.getCode();
|
||||
}
|
||||
return builder.productType(LegConstant.LEG_TYPE_AIRPLANE)
|
||||
.flightOrderDetailData(flightOrderInfo)
|
||||
.currencyCode(flightOrderInfo.getBasicInfo().getCurrency())
|
||||
.currencyCode(currency)
|
||||
.orderTime(flightOrderInfo.getBasicInfo().getCreateTime())
|
||||
.startTime(flightInfo.getTakeoffTime())
|
||||
.endTime(flightInfo.getArrivalTime())
|
||||
|
|
Loading…
Reference in New Issue