From ba6c824fd068679f9fed7fd3d59d3359b510c103 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 8 Apr 2024 22:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../in/RouteRequestController.java | 27 +++++++++++++++++-- .../order_detail/OrderDetailFactory.java | 1 + .../CTripOrderRecordExtensionFactory.java | 10 ++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/chint/application/in/RouteRequestController.java b/src/main/java/com/chint/application/in/RouteRequestController.java index fa87f14c..6e424a43 100644 --- a/src/main/java/com/chint/application/in/RouteRequestController.java +++ b/src/main/java/com/chint/application/in/RouteRequestController.java @@ -1,5 +1,8 @@ package com.chint.application.in; +import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.RouteRequest; +import com.chint.domain.repository.RouteRepository; import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.value_object.SyncLegData; import com.chint.infrastructure.util.Result; @@ -11,6 +14,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.swing.*; + +import java.util.List; + import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; @RestController @@ -20,21 +27,37 @@ public class RouteRequestController { @Autowired private RouteRequestDomainService routeRequestDomainService; + @Autowired + private RouteRepository routeRepository; + @Transactional @ApiOperation("同步行程规划单到差旅平台") - @PostMapping("/sync/whole") + @PostMapping("/sync") public Result syncRouterOrder(@RequestBody SyncLegData syncLegData) { routeRequestDomainService.syncRouteRequestToSupplier(syncLegData); return Result.Success(SUCCESS); } + @Transactional + @ApiOperation("查询差旅申请单") + @PostMapping("/query") + public Result> queryByRouterId(@RequestBody SyncLegData syncLegData) { + RouteOrder routeOrder = routeRepository.queryById(syncLegData.getRouteId()); + List routeRequestList = routeOrder.getRouteRequestList(); + routeRequestList.forEach(RouteRequest::reloadStatus); + return Result.Success(SUCCESS, routeRequestList); + } + + @Transactional @ApiOperation("取消行程规划单到差旅平台") - @PostMapping("/sync/whole") + @PostMapping("/cancel") public Result cancelWholeRouterOrder(@RequestBody SyncLegData syncLegData) { routeRequestDomainService.cancelRouteRequest(syncLegData); return Result.Success(SUCCESS); } + + } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java index a6acf881..1b3df29b 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java @@ -17,5 +17,6 @@ public interface OrderDetailFactory { TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional orderDetail); HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); + CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index d8e2d885..02c55cce 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -11,6 +11,7 @@ import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.UserRepository; import com.chint.domain.service.OrderDetailDomainService; +import com.chint.domain.service.RouteRequestDomainService; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.user.UserHttpRequest; @@ -42,6 +43,9 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Autowired private UserHttpRequest userHttpRequest; + @Autowired + private RouteRequestDomainService routeRequestDomainService; + private String getBeLongSysType(String sysCode) { String res = null; if (sysCode != null) { @@ -85,7 +89,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; String routeOrderNo = cTripCarRecord.getRouteOrderNo(); - Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); + Optional byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo)); OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); @@ -241,7 +245,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); - Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); + Optional byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo)); OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) .flightRecord(); @@ -413,7 +417,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); - Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); + Optional byOrderNo = Optional.ofNullable(routeRequestDomainService.getRouteOrder(routeOrderNo)); OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) .hotelRecord();