From 7f0acc3b3f3937483fc869d5df995a04a9b64ee4 Mon Sep 17 00:00:00 2001 From: nixj Date: Thu, 13 Jun 2024 13:52:43 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90add=E3=80=91=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jdbc/JdbcOrderDetailRepository.java | 12 +- .../repository/jdbc/JdbcRouteRepository.java | 2 + .../chint/manage/entity/dto/OrderPageDto.java | 33 ---- .../manage/entity/excel/OrderPageExcel.java | 93 +++++++++++ .../manage/entity/query/OrderPageQuery.java | 14 +- .../mapper/JdbcCarOrderDetailRepository.java | 3 + .../JdbcFlightOrderDetailRepository.java | 2 + .../JdbcHotelOrderDetailRepository.java | 3 + .../JdbcTrainOrderDetailRepository.java | 2 + .../chint/manage/service/ManageService.java | 5 +- .../service/impl/ManageServiceImpl.java | 148 +++++++++++++++--- src/test/java/com/chint/ManageTest.java | 2 +- 12 files changed, 254 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/com/chint/manage/entity/dto/OrderPageDto.java create mode 100644 src/main/java/com/chint/manage/entity/excel/OrderPageExcel.java diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java index 943f5d06..368e903e 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -40,16 +40,20 @@ public interface JdbcOrderDetailRepository extends CrudRepository listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest")PageRequest pageRequest); @Query("SELECT COUNT(*) FROM order_detail " + - "WHERE 1=1 " + + "WHERE 1=1 " + "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); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java index a4b68834..edd45cda 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -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 findByActualOrderNo(@Param("actualOrderNo") String actualOrderNo); + List findAllByRouteOrderNoContains(String routeOrderNo); + } diff --git a/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java b/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java deleted file mode 100644 index 9b61616c..00000000 --- a/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java +++ /dev/null @@ -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; -} diff --git a/src/main/java/com/chint/manage/entity/excel/OrderPageExcel.java b/src/main/java/com/chint/manage/entity/excel/OrderPageExcel.java new file mode 100644 index 00000000..6d791d59 --- /dev/null +++ b/src/main/java/com/chint/manage/entity/excel/OrderPageExcel.java @@ -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; + } +} diff --git a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java index c8720cde..b965caca 100644 --- a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java @@ -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 userIds=new ArrayList<>(); + private List belongDeptCode=null; + private String employeeNo=""; + + private List employeeNos=null; + + private List routeIds=null; public String getOrderNo() { return "%" +orderNo+"%"; diff --git a/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java index b8090d97..9ce9e78e 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java @@ -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 findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List orderNo,List orderIds, Pageable pageable); Page findAllByUserNameContainsAndOrderIdIn(String userName,List orderIds, Pageable pageable); + + List findAllByOrderIdIn(List orderIds); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java index 7d4169c3..b60bd6e6 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java @@ -17,4 +17,6 @@ public interface JdbcFlightOrderDetailRepository extends CrudRepository findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List orderNo,List orderIds, Pageable pageable); Page findAllByUserNameContainsAndOrderIdIn(String userName,List orderIds, Pageable pageable); + + List findAllByOrderIdIn(List orderIds); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java index cc2e45bf..da1fe8db 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java @@ -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 findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(String userName, List orderNo,List orderIds, Pageable pageable); Page findAllByBookingNameContainsAndOrderIdIn(String userName,List orderIds, Pageable pageable); + + List findAllByOrderIdIn(List orderIds); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java index 9885972d..befad4b5 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java @@ -16,4 +16,6 @@ public interface JdbcTrainOrderDetailRepository extends CrudRepository findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List orderNo,List orderIds ,Pageable pageable); Page findAllByUserNameContainsAndOrderIdIn(String userName,List orderIds, Pageable pageable); + + List findAllByOrderIdIn(List orderIds); } diff --git a/src/main/java/com/chint/manage/service/ManageService.java b/src/main/java/com/chint/manage/service/ManageService.java index ed8ed196..cad838ab 100644 --- a/src/main/java/com/chint/manage/service/ManageService.java +++ b/src/main/java/com/chint/manage/service/ManageService.java @@ -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 orderDownloadRecordQuery(); - PageResult orderPageQuery(OrderPageQuery dto); + PageResult orderPageQuery(OrderPageQuery dto); } diff --git a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java index 8247e479..4d19c15c 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -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 pageConsumptionDetail(ConsumptionDetailQuery dto) { @@ -161,30 +169,134 @@ public class ManageServiceImpl implements ManageService { } @Override - public PageResult orderPageQuery(OrderPageQuery dto) { + public PageResult orderPageQuery(OrderPageQuery dto) { +// //数据权限 +// List routeIds=baseUtil.getRouteIds(); +// if (routeIds==null||routeIds.isEmpty()) { +// return PageResult.totalPageNum(0, new ArrayList<>()); +// } + //行程号 + if (!dto.getRouteOrderNo().isEmpty()){ + List routeOrders=jdbcRouteRepository.findAllByRouteOrderNoContains(dto.getRouteOrderNo()); + if (dto.getRouteIds()==null){ + dto.setRouteIds(routeOrders.stream().map(RouteOrder::getRouteId).toList()); + }else { + List 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 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 AnB = dto.getRouteIds().stream().filter(routeOrderExtensionFields.stream().map(RouteOrderExtensionField::getRouteId).toList()::contains).collect(Collectors.toList()); + dto.setRouteIds(AnB); + } + } + List list=jdbcOrderDetailRepository.listByCondition(dto,dto.getPageResult()); //处理地点信息 List locationIds = new ArrayList<>(list.stream().map(OrderDetail::getOriginId).toList()); locationIds.addAll(list.stream().map(OrderDetail::getDestinationId).toList()); List locations=locationRepository.findByLocationIdIn(locationIds); + //根据类型处理出行订单信息 + Map orderPageDtoMap=new HashMap<>(); + Map> collect = list.stream().collect(Collectors.groupingBy(OrderDetail::getProductType)); + for (Map.Entry> entry : collect.entrySet()) { + int type = entry.getKey(); + List 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 routeIds=list.stream().map(OrderDetail::getRouteId).toList(); + List routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIds); - List result = list.stream().map(temp -> { - OrderPageDto obj = new OrderPageDto(); + List 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 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 entry,Map orderPageDtoMap){ + if (entry!=null&&!entry.isEmpty()){ + List 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 entry,Map orderPageDtoMap){ + if (entry!=null&&!entry.isEmpty()){ + List 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 entry,Map orderPageDtoMap){ + if (entry!=null&&!entry.isEmpty()){ + List 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 entry,Map orderPageDtoMap){ + if (entry!=null&&!entry.isEmpty()){ + List 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 getOrderExceedStandardExcels(Page page) { List orderList = page.getContent(); List excelList = new ArrayList<>(); diff --git a/src/test/java/com/chint/ManageTest.java b/src/test/java/com/chint/ManageTest.java index 1d5a4562..7f80971f 100644 --- a/src/test/java/com/chint/ManageTest.java +++ b/src/test/java/com/chint/ManageTest.java @@ -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("已完成")