【add】订单分页查询功能实现
This commit is contained in:
parent
925e4c5954
commit
7f0acc3b3f
|
@ -42,6 +42,8 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
"AND (:#{#dto.applicant} ='' OR supplier_name LIKE :#{#dto.applicant}) " +
|
||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime}) " +
|
||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) " +
|
||||
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) " +
|
||||
"AND (:#{#dto.employeeNos} IS NULL OR employee_no IN (:#{#dto.employeeNos})) " +
|
||||
"LIMIT :#{#pageRequest.pageSize} OFFSET :#{#pageRequest.pageNumber}")
|
||||
List<OrderDetail> listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest")PageRequest pageRequest);
|
||||
|
||||
|
@ -50,6 +52,8 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
||||
"AND (:#{#dto.applicant} ='' OR supplier_name LIKE :#{#dto.applicant}) " +
|
||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime} ) " +
|
||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) ")
|
||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) "+
|
||||
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) "+
|
||||
"AND (:#{#dto.employeeNos} IS NULL OR employee_no IN (:#{#dto.employeeNos})) ")
|
||||
Integer countByCondition(@Param("dto") OrderPageQuery dto);
|
||||
}
|
||||
|
|
|
@ -59,4 +59,6 @@ select * from route_order r1 left join route_custom_extension_field r2 on r1.rou
|
|||
@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);
|
||||
|
||||
List<RouteOrder> findAllByRouteOrderNoContains(String routeOrderNo);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
package com.chint.manage.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderPageDto {
|
||||
private Long routeId;
|
||||
private String orderNo;
|
||||
private String supplierName;
|
||||
private Integer productType;
|
||||
private String price; // 价格
|
||||
private String employeeNo;
|
||||
//出发
|
||||
private Long originId;
|
||||
private String originName;
|
||||
//目的地
|
||||
private Long destinationId;
|
||||
private String destinationName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime orderDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime endTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.chint.manage.entity.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||
|
||||
@Data
|
||||
public class OrderPageExcel extends BaseExcel {
|
||||
@ExcelIgnore
|
||||
private Long routeId;
|
||||
@ExcelProperty("订单号")
|
||||
private String orderNo;
|
||||
@ExcelProperty("行程号")
|
||||
private String routeOrderNo;
|
||||
@ExcelProperty("出行人")
|
||||
private String travelers;
|
||||
@ExcelIgnore
|
||||
private String status;
|
||||
@ExcelProperty("订单状态")
|
||||
private String statusName;
|
||||
@ExcelProperty("预订人")
|
||||
private String supplierName;
|
||||
@ExcelIgnore
|
||||
private Integer productType;
|
||||
@ExcelProperty("订单类型")
|
||||
private String productTypeName;
|
||||
@ExcelProperty("价格")
|
||||
private String price; // 价格
|
||||
@ExcelProperty
|
||||
private String employeeNo;
|
||||
@ExcelIgnore
|
||||
private Long originId;
|
||||
@ExcelProperty("出发地")
|
||||
private String originName;
|
||||
@ExcelIgnore
|
||||
private Long destinationId;
|
||||
@ExcelProperty("目的地")
|
||||
private String destinationName;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ExcelProperty("订单创建时间")
|
||||
private LocalDateTime orderDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ExcelProperty("订单开始时间")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ExcelProperty("订单结束时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
public String getProductTypeName(){
|
||||
switch (productType){
|
||||
case LEG_TYPE_AIRPLANE: productTypeName="飞机";break;
|
||||
case LEG_TYPE_TAXI: productTypeName="打车";break;
|
||||
case LEG_TYPE_TRAIN: productTypeName="火车";break;
|
||||
case LEG_TYPE_HOTEL: productTypeName="酒店";break;
|
||||
}
|
||||
return productTypeName;
|
||||
}
|
||||
|
||||
public String getStatusName(){
|
||||
if (status==null){
|
||||
return status;
|
||||
}
|
||||
if(productType.equals(LEG_TYPE_HOTEL)){
|
||||
switch (status){
|
||||
// 订单状态:1-预订成功,3-全部退订成功,4-部分退订成功
|
||||
case "1": statusName="预订成功";
|
||||
break;
|
||||
case "3": statusName="全部退订成功";
|
||||
break;
|
||||
case "4": statusName="部分退订成功";
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
// 订单状态:0-取消 1-出票成功,2-改签成功,3-退票成功
|
||||
switch (status){
|
||||
case "1": statusName="出票成功";
|
||||
break;
|
||||
case "2": statusName="改签成功";
|
||||
break;
|
||||
case "3": statusName="退票成功";
|
||||
break;
|
||||
case "0": statusName="取消";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return statusName;
|
||||
}
|
||||
}
|
|
@ -10,10 +10,8 @@ import java.util.List;
|
|||
public class OrderPageQuery extends BaseQuery {
|
||||
//订单号
|
||||
private String orderNo="";
|
||||
//申请单号
|
||||
private String actualOrderNo="";
|
||||
//出行人
|
||||
private String travelers="";
|
||||
//行程号
|
||||
private String routeOrderNo="";
|
||||
//预订人
|
||||
private String applicant="";
|
||||
//开始日期
|
||||
|
@ -25,8 +23,12 @@ public class OrderPageQuery extends BaseQuery {
|
|||
*/
|
||||
private String productType="";
|
||||
//部门名称
|
||||
private String deptName="";
|
||||
private List<String> userIds=new ArrayList<>();
|
||||
private List<String> belongDeptCode=null;
|
||||
private String employeeNo="";
|
||||
|
||||
private List<String> employeeNos=null;
|
||||
|
||||
private List<Long> routeIds=null;
|
||||
|
||||
public String getOrderNo() {
|
||||
return "%" +orderNo+"%";
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.manage.mapper;
|
|||
|
||||
import com.chint.domain.aggregates.order.CarOrderDetail;
|
||||
import com.chint.domain.aggregates.order.HotelOrderDetail;
|
||||
import com.chint.domain.aggregates.order.TrainOrderDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
@ -17,4 +18,6 @@ public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDet
|
|||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<CarOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -17,4 +17,6 @@ public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOr
|
|||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<FlightOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ 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.TrainOrderDetail;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
@ -18,4 +19,6 @@ public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrde
|
|||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<HotelOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrde
|
|||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds ,Pageable pageable);
|
||||
|
||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<TrainOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -3,14 +3,13 @@ package com.chint.manage.service;
|
|||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.OrderDownloadRecord;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.excel.OrderPageExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import com.chint.manage.entity.query.OrderPageQuery;
|
||||
import com.chint.manage.entity.query.StandardQuery;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
@ -36,5 +35,5 @@ public interface ManageService {
|
|||
|
||||
List<OrderDownloadRecord> orderDownloadRecordQuery();
|
||||
|
||||
PageResult<OrderPageDto> orderPageQuery(OrderPageQuery dto);
|
||||
PageResult<OrderPageExcel> orderPageQuery(OrderPageQuery dto);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.chint.manage.service.impl;
|
||||
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.LegDomainService;
|
||||
|
@ -16,16 +13,16 @@ import com.chint.infrastructure.util.BaseContext;
|
|||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.OrderDownloadRecord;
|
||||
import com.chint.manage.entity.OrderExceedStandard;
|
||||
import com.chint.manage.entity.RouteOrderExtensionField;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.excel.OrderPageExcel;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import com.chint.manage.entity.query.OrderPageQuery;
|
||||
import com.chint.manage.entity.query.StandardQuery;
|
||||
import com.chint.manage.mapper.JdbcOrderDownloadRecordRepository;
|
||||
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
|
||||
import com.chint.manage.mapper.*;
|
||||
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
|
||||
import com.chint.manage.service.ManageService;
|
||||
import com.chint.manage.util.BaseUtil;
|
||||
|
@ -38,12 +35,13 @@ import org.springframework.data.domain.Sort;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author:nxj
|
||||
|
@ -71,6 +69,16 @@ public class ManageServiceImpl implements ManageService {
|
|||
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcLocationRepository locationRepository;
|
||||
@Autowired
|
||||
private JdbcRouteOrderExtensionFieldRepository jdbcRouteOrderExtensionFieldRepository;
|
||||
@Autowired
|
||||
private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcCarOrderDetailRepository jdbcCarOrderDetailRepository;
|
||||
|
||||
@Override
|
||||
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
|
||||
|
@ -161,30 +169,134 @@ public class ManageServiceImpl implements ManageService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderPageDto> orderPageQuery(OrderPageQuery dto) {
|
||||
public PageResult<OrderPageExcel> orderPageQuery(OrderPageQuery dto) {
|
||||
// //数据权限
|
||||
// List<Long> routeIds=baseUtil.getRouteIds();
|
||||
// if (routeIds==null||routeIds.isEmpty()) {
|
||||
// return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
// }
|
||||
//行程号
|
||||
if (!dto.getRouteOrderNo().isEmpty()){
|
||||
List<RouteOrder> routeOrders=jdbcRouteRepository.findAllByRouteOrderNoContains(dto.getRouteOrderNo());
|
||||
if (dto.getRouteIds()==null){
|
||||
dto.setRouteIds(routeOrders.stream().map(RouteOrder::getRouteId).toList());
|
||||
}else {
|
||||
List<Long> AnB = dto.getRouteIds().stream().filter(routeOrders.stream().map(RouteOrder::getRouteId).toList()::contains).collect(Collectors.toList());
|
||||
dto.setRouteIds(AnB);
|
||||
}
|
||||
}
|
||||
//部门
|
||||
if (dto.getBelongDeptCode()!=null&&!dto.getBelongDeptCode().isEmpty()) {
|
||||
List<RouteOrderExtensionField> routeOrderExtensionFields=jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(dto.getBelongDeptCode());
|
||||
if (routeOrderExtensionFields==null||routeOrderExtensionFields.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
if (dto.getRouteIds()==null){
|
||||
dto.setRouteIds(routeOrderExtensionFields.stream().map(RouteOrderExtensionField::getRouteId).toList());
|
||||
}else {
|
||||
List<Long> AnB = dto.getRouteIds().stream().filter(routeOrderExtensionFields.stream().map(RouteOrderExtensionField::getRouteId).toList()::contains).collect(Collectors.toList());
|
||||
dto.setRouteIds(AnB);
|
||||
}
|
||||
}
|
||||
|
||||
List<OrderDetail> list=jdbcOrderDetailRepository.listByCondition(dto,dto.getPageResult());
|
||||
//处理地点信息
|
||||
List<Long> locationIds = new ArrayList<>(list.stream().map(OrderDetail::getOriginId).toList());
|
||||
locationIds.addAll(list.stream().map(OrderDetail::getDestinationId).toList());
|
||||
List<Location> locations=locationRepository.findByLocationIdIn(locationIds);
|
||||
//根据类型处理出行订单信息
|
||||
Map<Long, OrderPageExcel> orderPageDtoMap=new HashMap<>();
|
||||
Map<Integer, List<OrderDetail>> collect = list.stream().collect(Collectors.groupingBy(OrderDetail::getProductType));
|
||||
for (Map.Entry<Integer, List<OrderDetail>> entry : collect.entrySet()) {
|
||||
int type = entry.getKey();
|
||||
List<OrderDetail> details = entry.getValue();
|
||||
switch (type) {
|
||||
case LEG_TYPE_TRAIN -> dealOrderTrainRecord(details,orderPageDtoMap);
|
||||
case LEG_TYPE_AIRPLANE -> dealOrderFlightRecord(details,orderPageDtoMap);
|
||||
case LEG_TYPE_HOTEL -> dealOrderHotelRecord(details,orderPageDtoMap);
|
||||
case LEG_TYPE_TAXI -> dealOrderCarRecord(details,orderPageDtoMap);
|
||||
}
|
||||
}
|
||||
//处理行程单信息
|
||||
List<Long> routeIds=list.stream().map(OrderDetail::getRouteId).toList();
|
||||
List<RouteOrder> routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIds);
|
||||
|
||||
List<OrderPageDto> result = list.stream().map(temp -> {
|
||||
OrderPageDto obj = new OrderPageDto();
|
||||
List<OrderPageExcel> result = list.stream().map(temp -> {
|
||||
OrderPageExcel obj = orderPageDtoMap.get(temp.getOrderId());
|
||||
if (obj==null){
|
||||
obj=new OrderPageExcel();
|
||||
}
|
||||
BeanUtils.copyProperties(temp, obj);
|
||||
Location origin=locations.stream().filter(s->s.getLocationId().equals(obj.getOriginId())).toList().get(0);
|
||||
Location destination=locations.stream().filter(s->s.getLocationId().equals(obj.getDestinationId())).toList().get(0);
|
||||
OrderPageExcel finalObj = obj;
|
||||
Location origin=locations.stream().filter(s->s.getLocationId().equals(finalObj.getOriginId())).toList().get(0);
|
||||
Location destination=locations.stream().filter(s->s.getLocationId().equals(finalObj.getDestinationId())).toList().get(0);
|
||||
if (origin!=null){
|
||||
obj.setOriginName(origin.getLocationName());
|
||||
finalObj.setOriginName(origin.getLocationName());
|
||||
}
|
||||
if (destination!=null){
|
||||
obj.setDestinationName(destination.getLocationName());
|
||||
finalObj.setDestinationName(destination.getLocationName());
|
||||
}
|
||||
return obj;
|
||||
List<RouteOrder> orders=routeOrders.stream().filter(s->s.getRouteId().equals(finalObj.getRouteId())).toList();
|
||||
if (!orders.isEmpty()) {
|
||||
finalObj.setRouteOrderNo(orders.get(0).getRouteOrderNo());
|
||||
}
|
||||
return finalObj;
|
||||
}).toList();
|
||||
Integer count=jdbcOrderDetailRepository.countByCondition(dto);
|
||||
return PageResult.totalPageNum(count, result);
|
||||
}
|
||||
|
||||
private void dealOrderTrainRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||
if (entry!=null&&!entry.isEmpty()){
|
||||
List<TrainOrderDetail> trainOrderDetails=jdbcTrainOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
||||
for (TrainOrderDetail trainOrderDetail : trainOrderDetails) {
|
||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||
orderPageDto.setStatus(trainOrderDetail.getOrderStatus());
|
||||
orderPageDto.setTravelers(trainOrderDetail.getUserName());
|
||||
orderPageDtoMap.put(trainOrderDetail.getOrderId(),orderPageDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dealOrderFlightRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||
if (entry!=null&&!entry.isEmpty()){
|
||||
List<FlightOrderDetail> flightOrderDetails=jdbcFlightOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
||||
for (FlightOrderDetail flightOrderDetail : flightOrderDetails) {
|
||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||
orderPageDto.setStatus(flightOrderDetail.getOrderStatus());
|
||||
orderPageDto.setTravelers(flightOrderDetail.getUserName());
|
||||
orderPageDtoMap.put(flightOrderDetail.getOrderId(),orderPageDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dealOrderHotelRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||
if (entry!=null&&!entry.isEmpty()){
|
||||
List<HotelOrderDetail> hotelOrderDetails=jdbcHotelOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
||||
for (HotelOrderDetail hotelOrderDetail : hotelOrderDetails) {
|
||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||
orderPageDto.setStatus(hotelOrderDetail.getOrderStatus());
|
||||
String userNames = hotelOrderDetail.getCustomers().stream()
|
||||
.map(HotelOrderDetailCustomer::getUserName) // 获取用户名
|
||||
.collect(Collectors.joining(",")); // 用逗号分隔拼接
|
||||
orderPageDto.setTravelers(userNames);
|
||||
orderPageDtoMap.put(hotelOrderDetail.getOrderId(),orderPageDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dealOrderCarRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||
if (entry!=null&&!entry.isEmpty()){
|
||||
List<CarOrderDetail> carOrderDetails=jdbcCarOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
||||
for (CarOrderDetail carOrderDetail : carOrderDetails) {
|
||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||
orderPageDto.setStatus(carOrderDetail.getOrderStatus());
|
||||
orderPageDto.setTravelers(carOrderDetail.getUserName());
|
||||
orderPageDtoMap.put(carOrderDetail.getOrderId(),orderPageDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<OrderExceedStandardExcel> getOrderExceedStandardExcels(Page<OrderExceedStandard> page) {
|
||||
List<OrderExceedStandard> orderList = page.getContent();
|
||||
List<OrderExceedStandardExcel> excelList = new ArrayList<>();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ManageTest {
|
|||
@Test
|
||||
void recordAdd(){
|
||||
OrderPageQuery dto=new OrderPageQuery();
|
||||
dto.setOderNo("123");
|
||||
dto.setOrderNo("123");
|
||||
OrderDownloadRecord downloadRecord=OrderDownloadRecord.builder()
|
||||
.fileUrl("url")
|
||||
.status("已完成")
|
||||
|
|
Loading…
Reference in New Issue