From 428990b6e8eabba17b6f1e5085e6363b6acf109b Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 09:02:47 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E3=80=90add=E3=80=91=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E7=99=BB=E5=BD=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/chint/application/system/UserController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/chint/application/system/UserController.java b/src/main/java/com/chint/application/system/UserController.java index f98c0775..fb87565e 100644 --- a/src/main/java/com/chint/application/system/UserController.java +++ b/src/main/java/com/chint/application/system/UserController.java @@ -125,4 +125,10 @@ public class UserController { } return Result.Success(SUCCESS, userDepartmentInfoList); } + + @ApiOperation("获取当前登录用户信息") + @PostMapping("/current") + public Result currentUser() { + return Result.Success(SUCCESS, BaseContext.getCurrentUser()); + } } From 21470758cfe2fa92be6dc0934d7e495aa8517e34 Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 09:56:15 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E3=80=90fix=E3=80=91=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E5=8D=95=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=BAnull=E4=B8=BA=E7=A9=BA=E6=97=B6=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/impl/JdbcConsumptionDetailRepositoryImpl.java | 3 +++ .../com/chint/manage/service/impl/ManageServiceImpl.java | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index 29148b91..129a723a 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -54,6 +54,9 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai } Map params = new HashMap<>(); + if (dto.getActualOrderNo()!=null&&dto.getActualOrderNo().isEmpty()){ + dto.setActualOrderNo(null); + } params.put("actualOrderNo", dto.getActualOrderNo()); params.put("userIds", dto.getUserIds()); PageRequest pageRequest = PageRequest 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 98f1de08..8b645400 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -89,9 +89,12 @@ public class ManageServiceImpl implements ManageService { @Override public PageResult itineraryPageQuery(ItineraryPageQuery dto) { - List users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); - if (users==null||users.isEmpty()){ - return null; + List users=new ArrayList<>(); + if (dto.getApplicant()!=null&&!dto.getApplicant().isEmpty()){ + users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); + if (users==null||users.isEmpty()){ + return null; + } } dto.setUserIds(users.stream().map(User::getEmployeeNo).toList()); Page page= jdbcConsumptionDetailRepository.itineraryPageQueryByDto(dto); From bd97a783060618c08510de59a4a5695742c7e903 Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 10:10:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E3=80=90update=E3=80=91=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E4=BC=A0=E5=8F=82null=E8=AE=BE=E7=BD=AE=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/entity/query/ConsumptionDetailQuery.java | 4 ++-- .../chint/manage/entity/query/ItineraryPageQuery.java | 4 ++-- .../com/chint/manage/entity/query/OrderPageQuery.java | 10 +++++----- .../impl/JdbcConsumptionDetailRepositoryImpl.java | 9 ++------- .../chint/manage/service/impl/ManageServiceImpl.java | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java b/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java index dfd37b77..9c5300e6 100644 --- a/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java +++ b/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java @@ -14,6 +14,6 @@ public class ConsumptionDetailQuery extends BaseQuery{ * 0-火车 1飞机 2酒店 3打车 */ private Integer productType; - private String userName; - private String orderNo; + private String userName=""; + private String orderNo=""; } diff --git a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java index 62e2ebc1..4d7e7639 100644 --- a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java @@ -8,7 +8,7 @@ import java.util.List; @Data public class ItineraryPageQuery extends BaseQuery { - private String applicant;// 申请人 - private String actualOrderNo; //申请单号 + private String applicant="";// 申请人 + private String actualOrderNo=""; //申请单号 private List userIds=new ArrayList<>(); } 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 f3e08024..ae52fbbd 100644 --- a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java @@ -9,13 +9,13 @@ import java.util.List; @Data public class OrderPageQuery extends BaseQuery { //订单号 - private String oderNo; + private String oderNo=""; //申请单号 - private String actualOrderNo; + private String actualOrderNo=""; //出行人 - private String travelers; + private String travelers=""; //预订人 - private String applicant; + private String applicant=""; //开始日期 private String startTime; //结束日期 @@ -23,6 +23,6 @@ public class OrderPageQuery extends BaseQuery { //产品类型 private String productType; //部门名称 - private String deptName; + private String deptName=""; private List userIds=new ArrayList<>(); } diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index 129a723a..934198de 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -54,7 +54,8 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai } Map params = new HashMap<>(); - if (dto.getActualOrderNo()!=null&&dto.getActualOrderNo().isEmpty()){ + //设置null + if (dto.getActualOrderNo().isEmpty()){ dto.setActualOrderNo(null); } params.put("actualOrderNo", dto.getActualOrderNo()); @@ -74,12 +75,6 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai @Override public PageResult pageConsumptionDetail(ConsumptionDetailQuery dto) { - if (dto.getUserName()==null){ - dto.setUserName(""); - } - if (dto.getOrderNo()==null){ - dto.setOrderNo(""); - } PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); Page data=new PageImpl<>(Collections.emptyList()); 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 8b645400..d3eefd9e 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -90,7 +90,7 @@ public class ManageServiceImpl implements ManageService { @Override public PageResult itineraryPageQuery(ItineraryPageQuery dto) { List users=new ArrayList<>(); - if (dto.getApplicant()!=null&&!dto.getApplicant().isEmpty()){ + if (!dto.getApplicant().isEmpty()){ users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); if (users==null||users.isEmpty()){ return null; From 1c73039ac77092b4aacb3b76b84ff805b740ab1e Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 13:38:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E3=80=90update=E3=80=91=E8=A1=8C=E7=A8=8B?= =?UTF-8?q?=E5=8D=95=E6=9F=A5=E8=AF=A2=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/entity/dto/ItineraryPageDto.java | 18 ++++++++---------- .../manage/service/impl/ManageServiceImpl.java | 10 ++++------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java index 85d034ed..94ec51e1 100644 --- a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java +++ b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java @@ -14,9 +14,9 @@ public class ItineraryPageDto { private Long routeId; //差旅订单单号 private String routeOrderNo; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime startTime; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime endTime; private String userId; private String userName; @@ -25,18 +25,16 @@ public class ItineraryPageDto { //申请说明 private String instructions; private String actualOrderNo; - private List approveEvents; +// private List approveEvents; private String approvalStatus; - private List legItems; - //差旅订单总价值 private List locationResList; - public String getApprovalStatus() { - if (this.approveEvents != null && !this.approveEvents.isEmpty()) { - ApprovalEvent lastApprovalEvent = getLastApprovalEvent(); + public String getApprovalStatus(List approveEvents) { + if (approveEvents != null && !approveEvents.isEmpty()) { + ApprovalEvent lastApprovalEvent = getLastApprovalEvent(approveEvents); if (lastApprovalEvent != null) { lastApprovalEvent.reloadStatus(); this.approvalStatus = lastApprovalEvent.getEventName(); @@ -44,7 +42,7 @@ public class ItineraryPageDto { } return approvalStatus; } - private ApprovalEvent getLastApprovalEvent() { - return this.approveEvents.isEmpty() ? null : this.approveEvents.get(this.approveEvents.size() - 1); + private ApprovalEvent getLastApprovalEvent(List approveEvents) { + return approveEvents.isEmpty() ? null : approveEvents.get(approveEvents.size() - 1); } } 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 d3eefd9e..062a557e 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -108,11 +108,10 @@ public class ManageServiceImpl implements ManageService { .stream() .map(routeOrder -> { RouteOrder order=routeOrders.stream().filter(s->s.getRouteId().equals(routeOrder.getRouteId())).toList().get(0); - routeOrder.setApproveEvents(order.getApproveEvents()); - routeOrder.setLegItems(order.getLegItems()); - legDomainService.queryLocation(routeOrder.getLegItems()); + legDomainService.queryLocation(order.getLegItems()); + routeOrder.setApprovalStatus(routeOrder.getApprovalStatus(order.getApproveEvents())); User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); - return getRouteOrderPageRes(routeOrder, user); + return getRouteOrderPageRes(routeOrder, user,order.getLegItems()); }) .toList(); return PageResult.totalPageNum(page.getTotalElements(), orders); @@ -148,8 +147,7 @@ public class ManageServiceImpl implements ManageService { return excelList; } - private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user) { - List legItems=res.getLegItems(); + private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user,List legItems) { List locationRes = legItems .stream() .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) From 0bf83c362c7f20c4181eb35af014fe9a152a2150 Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 14:47:22 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E3=80=90update=E3=80=91=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jdbc/JdbcOrderDetailRepository.java | 2 ++ .../repository/jdbc/JdbcRouteRepository.java | 7 +++++ .../entity/query/ConsumptionDetailQuery.java | 2 +- .../mapper/JdbcCarOrderDetailRepository.java | 7 +++++ .../JdbcFlightOrderDetailRepository.java | 7 +++++ .../JdbcHotelOrderDetailRepository.java | 7 +++++ .../JdbcTrainOrderDetailRepository.java | 6 ++++ .../JdbcConsumptionDetailRepositoryImpl.java | 29 ++++++++++++++++--- 8 files changed, 62 insertions(+), 5 deletions(-) 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 9ac69782..b8002582 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -28,4 +28,6 @@ public interface JdbcOrderDetailRepository extends CrudRepository findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType); List findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo); List findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); + + List findAllByRouteIdIn(Collection routeIds); } 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 e10381d1..a4b68834 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -6,6 +6,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; @@ -52,4 +53,10 @@ select * from route_order r1 left join route_custom_extension_field r2 on r1.rou List findByField(); List findByRouteOrderNoIn(Collection routeOrderNo); + + List 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 findByActualOrderNo(@Param("actualOrderNo") String actualOrderNo); + } diff --git a/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java b/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java index 9c5300e6..41407ec8 100644 --- a/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java +++ b/src/main/java/com/chint/manage/entity/query/ConsumptionDetailQuery.java @@ -15,5 +15,5 @@ public class ConsumptionDetailQuery extends BaseQuery{ */ private Integer productType; private String userName=""; - private String orderNo=""; + private String actualOrderNo=""; //申请单号 } diff --git a/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java index e618902d..e3c7238c 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcCarOrderDetailRepository.java @@ -1,13 +1,20 @@ package com.chint.manage.mapper; 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.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcCarOrderDetailRepository extends CrudRepository { Page findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); + + Page findAllByUserNameContainsAndOrderNoIn(String userName, List orderNo, Pageable pageable); + + Page findAllByUserNameContains(String userName, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java index e8d30c7c..2dc921c5 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcFlightOrderDetailRepository.java @@ -1,13 +1,20 @@ package com.chint.manage.mapper; 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.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcFlightOrderDetailRepository extends CrudRepository { Page findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); + + Page findAllByUserNameContainsAndOrderNoIn(String userName, List orderNo, Pageable pageable); + + Page findAllByUserNameContains(String userName, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java index 4fcda59e..1d73e0c2 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcHotelOrderDetailRepository.java @@ -1,5 +1,6 @@ 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.order_record.OrderHotelRecord; 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.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcHotelOrderDetailRepository extends CrudRepository { Page findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); + + Page findAllByBookingNameContainsAndOrderNoIn(String userName, List orderNo, Pageable pageable); + + Page findAllByBookingNameContains(String userName, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java index ca270676..24bacd8a 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcTrainOrderDetailRepository.java @@ -6,8 +6,14 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcTrainOrderDetailRepository extends CrudRepository { Page findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable); + + Page findAllByUserNameContainsAndOrderNoIn(String userName, List orderNo, Pageable pageable); + + Page findAllByUserNameContains(String userName, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index 934198de..e51ba020 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -1,6 +1,8 @@ package com.chint.manage.mapper.impl; 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.manage.entity.dto.ItineraryPageDto; import com.chint.manage.entity.query.ConsumptionDetailQuery; @@ -41,6 +43,10 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository; @Autowired private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository; + @Autowired + private JdbcRouteRepository jdbcRouteRepository; + @Autowired + private JdbcOrderDetailRepository jdbcOrderDetailRepository; @Override @@ -78,11 +84,26 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); Page data=new PageImpl<>(Collections.emptyList()); + //申请单查询 + if (!dto.getActualOrderNo().isEmpty()){ + List orderNos=jdbcRouteRepository.findByActualOrderNo("%" + dto.getActualOrderNo() + "%"); + if (orderNos.isEmpty()){ + return new PageResult(0,new ArrayList<>()); + } + switch (dto.getProductType()) { + case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest)); + case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoIn(dto.getUserName(),orderNos,pageRequest)); + case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoIn(dto.getUserName(),orderNos,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.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); - case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); - case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); - case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest)); + 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()); }