From 67f89d754fbd2a38c304bde6a91d366e6280398b Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 8 Apr 2024 16:56:36 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=BE=E8=AF=81?= =?UTF-8?q?=E5=9B=9E=E4=BC=A0=E7=BB=99=E8=B4=A2=E5=8A=A1=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/chint/application/queryies/OrderQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index 022e02ba..10068494 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -459,7 +459,7 @@ public class OrderQuery { if (leg.getLegType().equals(LEG_TYPE_OTHER) && Objects.requireNonNull(leg.getLegExtensionField()).getAmountType().equals(LEG_OTHER_AMOUNT_TYPE_VISA)) { scheduleDetailBuilder.expenseTypeId("6770f575013211eabce29fde958f48e4") .travelType("LOCAL_OTHER") - .scheduleType("visa"); + .scheduleType("VISA"); } else { scheduleDetailBuilder.scheduleType(translateLegType(leg.getLegType())); } From 81f8299d6aec1c3392afe7efafe96489da70e223 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 8 Apr 2024 16:58:34 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=B7=AE=E6=97=85=E7=94=B3=E8=AF=B7=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../in/RouteRequestController.java | 27 +++++++++++--- .../CTripOrderExtensionFactoryImpl.java | 21 +++++++---- .../LYOrderExtensionFactoryImpl.java | 5 +++ .../repository/RouteRequestRepository.java | 8 ++++ .../service/RouteRequestDomainService.java | 37 +++++++++++++++++++ .../service/leg_event/LegEventHandler.java | 6 ++- .../domain/value_object/SyncLegData.java | 1 + .../RouteRequestRepositoryImpl.java | 19 ++++++++++ .../jdbc/JdbcRouteRequestRepository.java | 11 ++++++ .../rest/user/UserHttpRequestImpl.java | 8 +++- 10 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/chint/domain/repository/RouteRequestRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/RouteRequestRepositoryImpl.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRequestRepository.java diff --git a/src/main/java/com/chint/application/in/RouteRequestController.java b/src/main/java/com/chint/application/in/RouteRequestController.java index 7cf17e05..fa87f14c 100644 --- a/src/main/java/com/chint/application/in/RouteRequestController.java +++ b/src/main/java/com/chint/application/in/RouteRequestController.java @@ -1,23 +1,40 @@ package com.chint.application.in; +import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.value_object.SyncLegData; import com.chint.infrastructure.util.Result; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; + @RestController @RequestMapping("/route/request") public class RouteRequestController { - @Transactional - @ApiOperation("根据整个行程规划单到差旅平台") - @PostMapping("/sync/whole") - public Result syncByWholeRouterOrder(@RequestBody SyncLegData syncLegData) { + @Autowired + private RouteRequestDomainService routeRequestDomainService; - return null; + @Transactional + @ApiOperation("同步行程规划单到差旅平台") + @PostMapping("/sync/whole") + public Result syncRouterOrder(@RequestBody SyncLegData syncLegData) { + routeRequestDomainService.syncRouteRequestToSupplier(syncLegData); + return Result.Success(SUCCESS); } + + @Transactional + @ApiOperation("取消行程规划单到差旅平台") + @PostMapping("/sync/whole") + 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/CTripOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java index 13938da9..4dcad0b2 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -3,10 +3,8 @@ package com.chint.domain.factoriy.order_detail; import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.NotFoundException; -import com.chint.domain.repository.LocationRepository; -import com.chint.domain.repository.OrderDetailRepository; -import com.chint.domain.repository.RouteRepository; -import com.chint.domain.repository.UserRepository; +import com.chint.domain.repository.*; +import com.chint.domain.service.RouteRequestDomainService; import com.chint.infrastructure.util.BigDecimalCalculator; import com.chint.interfaces.rest.ctrip.dto.search.car.*; import com.chint.interfaces.rest.ctrip.dto.search.flight.*; @@ -46,6 +44,13 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { @Autowired private OrderDetailFactory orderDetailFactory; + @Autowired + private RouteRequestRepository routeRequestRepository; + + @Autowired + private RouteRequestDomainService routeRequestDomainService; + + @Override public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { //获取基础信息数据 @@ -53,7 +58,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo(); String orderNo = carBasicInfo.getOrderId(); String journeyNo = carBasicInfo.getJourneyID(); - RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo); OrderDetail orderDetail = routeOrder.getOrderDetails() .stream() .filter(it -> it.getOrderNo().equals(orderNo)) @@ -76,7 +81,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { orderFeeList.forEach(it -> { if (it.getFeeName().equals("取消费")) { carOrderDetail.setCancellationFee(it.getAmount().toString()); - if(it.getAmount() > 0){ + if (it.getAmount() > 0) { carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND); } else { carOrderDetail.setOrderStatus(FSSC_ORDER_STATUS_CANCEL); @@ -156,7 +161,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { BasicInfo flightOrderBasicInfo = flightOrderInfoEntity.getBasicInfo(); String orderNo = flightOrderBasicInfo.getOrderID(); String journeyNo = flightOrderBasicInfo.getJourneyID(); - RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo); Optional first = routeOrder .getOrderDetails() @@ -359,7 +364,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { Optional byOrderNo = orderDetailRepository.findByOrderNo(orderNo); String journeyNo = hotelOrderInfoEntity.getJourneyNo(); - RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo).reloadStatus(); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo).reloadStatus(); ApproveOrderNo approveOrderNo = null; User user = null; diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java index c0bc8089..1fa221a3 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -6,6 +6,7 @@ import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; +import com.chint.domain.repository.RouteRequestRepository; import com.chint.domain.repository.UserRepository; import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail; import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; @@ -56,8 +57,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @Autowired private OrderDetailFactory orderDetailFactory; + @Autowired + private RouteRequestRepository routeRequestRepository; + private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); + @Override public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData; diff --git a/src/main/java/com/chint/domain/repository/RouteRequestRepository.java b/src/main/java/com/chint/domain/repository/RouteRequestRepository.java new file mode 100644 index 00000000..71472b82 --- /dev/null +++ b/src/main/java/com/chint/domain/repository/RouteRequestRepository.java @@ -0,0 +1,8 @@ +package com.chint.domain.repository; + + +import com.chint.domain.aggregates.order.RouteRequest; + +public interface RouteRequestRepository { + RouteRequest findByRouteRequestNo(String routeRequestNo); +} diff --git a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java index 48da6015..1f09e8b7 100644 --- a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java +++ b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java @@ -7,6 +7,7 @@ import com.chint.domain.aggregates.order.RouteRequestEvent; import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.repository.LegRepository; import com.chint.domain.repository.RouteRepository; +import com.chint.domain.repository.RouteRequestRepository; import com.chint.domain.service.order_sync.SyncAdapter; import com.chint.domain.value_object.SyncLegData; import org.springframework.beans.factory.annotation.Autowired; @@ -35,6 +36,9 @@ public class RouteRequestDomainService { @Autowired private LegRepository legRepository; + @Autowired + private RouteRequestRepository routeRequestRepository; + public RouteRequest syncRouteRequestToSupplier(SyncLegData syncLegData) { RouteOrder routeOrder = routeRepository.queryById(syncLegData.getRouteId()); @@ -56,6 +60,30 @@ public class RouteRequestDomainService { return routeRequest; } + public void cancelRouteRequest(SyncLegData syncLegData) { + Long routeId = syncLegData.getRouteId(); + RouteOrder routeOrder = routeRepository.queryById(routeId); + Optional optionalRouteRequest; + if (syncLegData.getRouteRequestId() != null) { + //如果指定的对应的差旅申请单 , 那么取消对应的差旅申请单 + optionalRouteRequest = routeOrder.getRouteRequestList() + .stream() + .filter(it -> it.getId().equals(syncLegData.getRouteRequestId())) + .findFirst(); + } else { + //如果指定的行程单号和供应商 , 该供应商对应的差旅申请单 + optionalRouteRequest = routeOrder.getRouteRequestList() + .stream() + .filter(it -> it.getSupplier().equals(syncLegData.getSupplierName())) + .findFirst(); + } + optionalRouteRequest.ifPresent(it -> { + it.addEvent(RouteRequestEvent.cancel(it.getSupplier())); + syncAdapter.of(it.getSupplier()).cancelRouteRequest(it); + }); + routeRepository.save(routeOrder); + } + //获取目前已经同步到供应商的差旅申请单 private RouteRequest getRouteRequest(RouteOrder routeOrder, List legIds, String supplier) { @@ -85,4 +113,13 @@ public class RouteRequestDomainService { .ifPresent(it::setLeg)); return routeRequest; } + + public RouteOrder getRouteOrder(String journeyNo) { + RouteOrder byOrderNo = routeRepository.findByOrderNo(journeyNo); + if (byOrderNo == null) { + RouteRequest byRouteRequestNo = routeRequestRepository.findByRouteRequestNo(journeyNo); + byOrderNo = routeRepository.queryById(byRouteRequestNo.getRouteId()); + } + return byOrderNo; + } } diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index f6b272b6..e6a7202d 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -13,6 +13,7 @@ import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.factoriy.order_detail.OrderDetailFactory; import com.chint.domain.repository.*; import com.chint.domain.service.OrderDomainService; +import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.service.order_sync.SyncAdapter; import com.chint.domain.value_object.ApprovalSimpleData; import com.chint.domain.value_object.ApproveRouteData; @@ -88,6 +89,9 @@ public class LegEventHandler implements LegEventService { @Autowired private OrderDomainService orderDomainService; + @Autowired + private RouteRequestDomainService routeRequestDomainService; + @Value("${chint.envMark}") private String envMark; @@ -218,7 +222,7 @@ public class LegEventHandler implements LegEventService { public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) { OrderLegData data = command.getData(); String orderNo = data.getSelfOrderNo(); - RouteOrder routeOrder = routeRepository.findByOrderNo(orderNo); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(orderNo); //获取行程规划单创建者作为该订单 String employeeNo = routeOrder.getUserId(); User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo); diff --git a/src/main/java/com/chint/domain/value_object/SyncLegData.java b/src/main/java/com/chint/domain/value_object/SyncLegData.java index 1d21f6c7..9cf3460e 100644 --- a/src/main/java/com/chint/domain/value_object/SyncLegData.java +++ b/src/main/java/com/chint/domain/value_object/SyncLegData.java @@ -7,6 +7,7 @@ import java.util.List; @Data public class SyncLegData { private Long routeId; + private Long routeRequestId; private List routeIds; private List legIds; private String supplierName; diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRequestRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRequestRepositoryImpl.java new file mode 100644 index 00000000..8b7f130f --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/RouteRequestRepositoryImpl.java @@ -0,0 +1,19 @@ +package com.chint.infrastructure.repository; + +import com.chint.domain.aggregates.order.RouteRequest; +import com.chint.domain.repository.RouteRequestRepository; +import com.chint.infrastructure.repository.jdbc.JdbcRouteRequestRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +@Repository +public class RouteRequestRepositoryImpl implements RouteRequestRepository { + + @Autowired + private JdbcRouteRequestRepository jdbcRouteRequestRepository; + + @Override + public RouteRequest findByRouteRequestNo(String routeRequestNo) { + return jdbcRouteRequestRepository.findByRouteRequestNo(routeRequestNo); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRequestRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRequestRepository.java new file mode 100644 index 00000000..189961dd --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRequestRepository.java @@ -0,0 +1,11 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.order.RouteRequest; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcRouteRequestRepository extends CrudRepository { + RouteRequest findByRouteRequestNo(String routeRequestNo); + +} diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 7a03b032..fd4099d9 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -196,7 +196,7 @@ public class UserHttpRequestImpl implements UserHttpRequest { .findFirst() .ifPresent(it -> { User byUserEmployeeNo = userRepository.findByUserEmployeeNo(user.getEmployeeNo()); - if(byUserEmployeeNo == null){ + if (byUserEmployeeNo == null) { userRepository.save( getDataFromUserSFData(user, it) ); @@ -290,6 +290,12 @@ public class UserHttpRequestImpl implements UserHttpRequest { //根据入账公司没有找到部门编码的话,直接获取主岗编码 deptCode = user.lowestDeptCode(); } + + if (deptCode == null) { + //如果还是空的话 , 就返回null + return null; + } + //清除部门编码里面的字母 return deptCode.replaceAll("\\D", ""); } From 6768db0cdc2704f792ea7eac6d83e933433c72f4 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 8 Apr 2024 22:11:10 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=B7=AE=E6=97=85=E7=94=B3=E8=AF=B7=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/chint/application/in/RouteRequestController.java | 2 +- .../java/com/chint/domain/aggregates/order/RouteRequest.java | 2 +- 2 files changed, 2 insertions(+), 2 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..76581075 100644 --- a/src/main/java/com/chint/application/in/RouteRequestController.java +++ b/src/main/java/com/chint/application/in/RouteRequestController.java @@ -30,7 +30,7 @@ public class RouteRequestController { @Transactional @ApiOperation("取消行程规划单到差旅平台") - @PostMapping("/sync/whole") + @PostMapping("/sync/wholeee") public Result cancelWholeRouterOrder(@RequestBody SyncLegData syncLegData) { routeRequestDomainService.cancelRouteRequest(syncLegData); return Result.Success(SUCCESS); diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java b/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java index fd55321a..8c374e46 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java @@ -30,7 +30,7 @@ public class RouteRequest implements Serializable, EventManageable { private Long routeOrderKey; - private String RouteRequestNo; + private String routeRequestNo; private String supplier; From e98af60faa714a79a32297bb83a0cae32b914acb Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 9 Apr 2024 09:54:41 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=B7=AE=E6=97=85=E7=94=B3=E8=AF=B7=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../in/RouteRequestController.java | 6 +- .../application/out/OrderOutController.java | 20 +- .../application/queryies/OrderQuery.java | 15 +- .../domain/aggregates/order/RouteRequest.java | 4 + .../factoriy/order/RouteOrderFactory.java | 6 +- .../CTripOrderExtensionFactoryImpl.java | 3 + .../LYOrderExtensionFactoryImpl.java | 348 +----------------- .../order_detail/OrderDetailFactoryImpl.java | 12 +- .../order_record/OrderRecordFactory.java | 94 ++--- .../domain/service/LegDomainService.java | 25 +- .../service/RouteRequestDomainService.java | 73 +++- .../service/leg_event/LegEventHandler.java | 11 +- .../domain/value_object/OrderQueryData.java | 3 + .../domain/value_object/SyncLegData.java | 6 + src/main/resources/application-test.yml | 8 +- 15 files changed, 209 insertions(+), 425 deletions(-) diff --git a/src/main/java/com/chint/application/in/RouteRequestController.java b/src/main/java/com/chint/application/in/RouteRequestController.java index 76581075..5f6094ba 100644 --- a/src/main/java/com/chint/application/in/RouteRequestController.java +++ b/src/main/java/com/chint/application/in/RouteRequestController.java @@ -22,7 +22,7 @@ public class RouteRequestController { @Transactional @ApiOperation("同步行程规划单到差旅平台") - @PostMapping("/sync/whole") + @PostMapping("/sync") public Result syncRouterOrder(@RequestBody SyncLegData syncLegData) { routeRequestDomainService.syncRouteRequestToSupplier(syncLegData); return Result.Success(SUCCESS); @@ -30,11 +30,13 @@ public class RouteRequestController { @Transactional @ApiOperation("取消行程规划单到差旅平台") - @PostMapping("/sync/wholeee") + @PostMapping("/cancel") public Result cancelWholeRouterOrder(@RequestBody SyncLegData syncLegData) { routeRequestDomainService.cancelRouteRequest(syncLegData); return Result.Success(SUCCESS); } + + } diff --git a/src/main/java/com/chint/application/out/OrderOutController.java b/src/main/java/com/chint/application/out/OrderOutController.java index 01173faa..0f0e611e 100644 --- a/src/main/java/com/chint/application/out/OrderOutController.java +++ b/src/main/java/com/chint/application/out/OrderOutController.java @@ -1,12 +1,15 @@ package com.chint.application.out; +import com.chint.application.dtos.response.LegRes; import com.chint.application.dtos.response.RouteOrderPageRes; import com.chint.application.dtos.response.RouteOrderRes; import com.chint.application.dtos.trip.TripCallback; import com.chint.application.queryies.OrderQuery; import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.UserRepository; +import com.chint.domain.service.LegDomainService; import com.chint.domain.service.OrderDomainService; import com.chint.domain.value_object.*; import com.chint.infrastructure.cache.RouteCacheService; @@ -16,7 +19,6 @@ import com.google.gson.Gson; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -44,6 +46,12 @@ public class OrderOutController { @Autowired private RouteCacheService routeCacheService; + @Autowired + private LegDomainService legDomainService; + + @Autowired + private RouteRepository routeRepository; + @ApiOperation("根据临时单号和系统编码查询订单") @PostMapping("/query/billcode") public Result queryOrderByBillCodeAndSysCode(@RequestBody OrderQueryData queryData) { @@ -75,7 +83,6 @@ public class OrderOutController { } - @ApiOperation("查询飞机估算价格") @PostMapping("/estimate/flight") public Result estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) { @@ -107,4 +114,13 @@ public class OrderOutController { return Result.Success(SUCCESS, orderQuery.queryNotSubmit(queryData)); } + + @ApiOperation("查询能够同步的行程节点") + @PostMapping("/query/legs") + public Result> queryLegs(@RequestBody OrderQueryData queryData) { + RouteOrder routeOrder = routeRepository.queryById(queryData.getRouteId()); + return Result.Success(SUCCESS, legDomainService + .queryLegsCanSync(routeOrder, queryData.getSupplierName()).stream().map(LegRes::copyFrom).toList()); + } + } diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index 10068494..371cf390 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -456,16 +456,17 @@ public class OrderQuery { } } - if (leg.getLegType().equals(LEG_TYPE_OTHER) && Objects.requireNonNull(leg.getLegExtensionField()).getAmountType().equals(LEG_OTHER_AMOUNT_TYPE_VISA)) { - scheduleDetailBuilder.expenseTypeId("6770f575013211eabce29fde958f48e4") - .travelType("LOCAL_OTHER") - .scheduleType("VISA"); - } else { - scheduleDetailBuilder.scheduleType(translateLegType(leg.getLegType())); - } +// if (leg.getLegType().equals(LEG_TYPE_OTHER) && Objects.requireNonNull(leg.getLegExtensionField()).getAmountType().equals(LEG_OTHER_AMOUNT_TYPE_VISA)) { +// scheduleDetailBuilder.expenseTypeId("6770f575013211eabce29fde958f48e4") +// .travelType("LOCAL_OTHER") +// .scheduleType("VISA"); +// } else { +// scheduleDetailBuilder +// } return scheduleDetailBuilder .scheduleNum(leg.getLegNo()) + .scheduleType(translateLegType(leg.getLegType())) .startDate(simpleFormatter.format(leg.getStartTime())) .endDate(simpleFormatter.format(leg.getEndTime())) .systemStatus(FSSCConstant.TRIP_CALLBACK_RECEIPT_STATUS) diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java b/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java index 8c374e46..d64bf337 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteRequest.java @@ -15,6 +15,7 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; @Data @@ -60,6 +61,9 @@ public class RouteRequest implements Serializable, EventManageable { @Override public List getEvents() { + if( this.eventList == null){ + this.eventList = new ArrayList<>(); + } return this.eventList; } diff --git a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java index b0d331a8..ccd80e2d 100644 --- a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java @@ -92,6 +92,8 @@ public class RouteOrderFactory implements OrderFactory { .map(RouteRequestLeg::ofLeg) .toList(); requestByRoute.setRouteRequestLegList(routeRequestLegs); + requestByRoute.setCreateTime(LocalDateTime.now()); + requestByRoute.setUpdateTime(LocalDateTime.now()); return requestByRoute; } @@ -114,7 +116,9 @@ public class RouteOrderFactory implements OrderFactory { RouteRequestFields routeRequestFields = BeanUtil.copyProperties(routeOrder.getApproveOrderNo(), RouteRequestFields.class); routeRequestFields.setUserId(routeOrder.getUserId()); - routeRequestFields.setBelongDeptCode(routeOrder.getRouterOrderExtensionField().getBelongDeptCode()); + if(routeOrder.getRouterOrderExtensionField() != null){ + routeRequestFields.setBelongDeptCode(routeOrder.getRouterOrderExtensionField().getBelongDeptCode()); + } routeRequestFields.setStandardLevel(routeOrder.getStandardLevel()); routeRequest.setRouteRequestFields(routeRequestFields); routeRequest.addEvent(RouteRequestEvent.prepare()); diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java index 4dcad0b2..2ab599b9 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -90,6 +90,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { }); } + carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); return updateCarOrderDetailData(carOrderDetail, carOrderDetailData); } @@ -185,6 +186,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { } }); + flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); updateFlightOrderDetailData(flightOrderDetail, flightOrderInfoEntity); return flightOrderDetail; } @@ -522,6 +524,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { .findFirst(); first1.ifPresent(orderEvent -> hotelOrderDetail.setOverStandardReason(orderEvent.getExtension())); + hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); return hotelOrderDetail; } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java index 1fa221a3..146dfc68 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -99,6 +99,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { } }); } + + carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); return updateCarOrderDetailData(carOrderDetail, data); } @@ -307,6 +309,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { //这里根据同程自带的字段进行状态映射 flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_REFUND); } + + flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); return updateFlightOrderDetailData(flightOrderDetail, flightOrderDetailData); } @@ -403,6 +407,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { hotelOrderDetail.setOrderStatus(FSSC_HOTEL_STATUS_SUCCESS); } + + hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); return updateHotelOrderDetailData(hotelOrderDetail, data); } @@ -502,156 +508,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { } - private HotelOrderDetail convertHotelOrderDetail(HotelDetailResponse.Data data) { - - - HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); - HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo(); - List roomList = data.getRoomList(); - HotelDetailResponse.Room room = null; - if (!data.getRoomList().isEmpty()) { - room = roomList.get(0); - } - - OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderInfo.getOrderSerialNo()) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - String standardLevel = routeOrder.getStandardLevel(); - - // PriceQueryData priceQueryData = new PriceQueryData(); - // priceQueryData.setDepartCity(hotelInfo.getCityName()); - // priceQueryData.setDepartDate(hotelInfo.getCheckInDate()); - // priceQueryData.setArriveDate(hotelInfo.getCheckOutDate()); - // HotelPriceData hotelPriceData = estimatePrice.queryHotelPrice(priceQueryData); - - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - - HotelOrderDetail hotelOrderDetail = new HotelOrderDetail(); - - hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } - } - - String EmployeeNo = routeOrder.getUserId(); - User user = userRepository.findByUserEmployeeNo(EmployeeNo); - if (orderInfo != null) { - hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo()) - .setDetailId(orderInfo.getOrderSerialNo()) -// .setSupplier(SUPPLIER_L_Y_EXTENSION_NAME) - .setReceiptsNum(routeOrder.getRouteOrderNo()) - .setOrderAmount(String.valueOf(orderInfo.getBusinessAmount())) - .setCreateTime(orderInfo.getCreateTime()) - .setCheckInCity(hotelInfo.getCityName()) - .setHotelName(hotelInfo.getHotelName()) - .setContactPhone(hotelInfo.getHotelTel()) - .setHotelAddress(hotelInfo.getHotelAddress()) - .setCheckInDate(hotelInfo.getCheckInDate()) - .setDepartureDate(hotelInfo.getCheckOutDate()) - .setNightCount(String.valueOf(hotelInfo.getNightNum())) - .setRoomCount(String.valueOf(hotelInfo.getRoomNum())) - .setRoomTypeName(hotelInfo.getRoomName()) - .setPaymentType(String.valueOf(orderInfo.getPaymentType())) - .setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice())) - .setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice())) - .setCompanyRefundAmount(String.valueOf(orderInfo.getCompanyRefundPrice())) - .setPersonalRefundAmount(String.valueOf(orderInfo.getPersonalRefundPrice())) - .setOrderAmount(String.valueOf(orderInfo.getTotalPrice())) - .setPreServiceFee(String.valueOf(orderInfo.getServicePrice())) - .setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice())) - .setRefundAmount(String.valueOf(orderInfo.getRefundPrice())) - .setAgreementHotel(orderInfo.getProtocolType() == 0 ? "否" : "是"); -// .setBookingName(orderInfo.getContactName()) //预订人名字和电话使用contact是否正确 -// .setBookingUserPhone(orderInfo.getContactPhone()) -// .setNightRates() //nightrates 是hotelInfo -// .setStarRate("4") -// .setBOOK_ORG_STRUCT_1("Org A") -// .setBOOK_ORG_STRUCT_2("Org B") -// .setBOOK_ORG_STRUCT_3("Org C") - } - - if (user != null) { - hotelOrderDetail.setBookingUserCode(user.getEmployeeNo()); - hotelOrderDetail.setBookingName(user.getName()); - hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - } - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - if (approveOrderNo != null) { -// hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany()); - hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - hotelOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - hotelOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); - hotelOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); - } - - Optional first1 = routeOrder - .getOrderDetails() - .stream() - .filter(it -> it.getOrderNo().equals(hotelOrderDetail.getOrderNo())) - .findFirst(); - - first1.ifPresent(it -> { - OrderEvent lastEvent = it.getLastEvent(); - if (lastEvent != null) { - hotelOrderDetail.setOrderStatus(lastEvent.mapToHotelOrderDetailStatus()); - } else { - //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 - Integer orderStatus = orderInfo.getOrderStatus(); - hotelOrderDetail.setOrderStatus( - OrderEvent.mapToHotelOrderDetailStatus( - LYOrderUtil.mapHotelStatus(orderStatus.toString()) - ) - ); - } - } - ); - - Optional firstOrderEvent = orderDetail.getOrderEventList() - .stream() - .map(OrderEvent::getEventType) - .filter(it -> it.equals(ORDER_EVENT_ETA)) - .findFirst(); - - if (firstOrderEvent.isEmpty()) { - hotelOrderDetail.setOverStandard("否"); //无 - } else { - hotelOrderDetail.setOverStandard("是"); //无 - } - Optional first2 = orderDetail.getOrderEventList() - .stream() - .findFirst(); - first2.ifPresent(orderEvent -> hotelOrderDetail.setOverStandardReason(orderEvent.getExtension())); - - List residentList = data.getResidentList(); - if (residentList != null && !residentList.isEmpty()) { - for (Resident resident : residentList) { - HotelOrderDetailCustomer customer = new HotelOrderDetailCustomer(); - customer.setUserName(resident.getName()); - customer.setPhone(resident.getContactPhone()); - customer.setUserCode(resident.getEmployeeCode()); - hotelOrderDetail.addCustomer(customer); - } - } - - if (room != null) { - hotelOrderDetail.setStandardItems(room.getDayStandardPrice()); - } - - - return hotelOrderDetail; - } - @Override public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { // 获取对象的Class对象 @@ -685,6 +541,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { } ); + trainOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); return updateTrainOrderDetailData(trainOrderDetail, trainDetailData); } @@ -766,197 +623,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { } - private TrainOrderDetail convertTrainOrderDetail(TrainDetailResponse.TrainDetailData trainDetailData) { - -// TrainDetailResponse.TrainDetailData trainDetailData = trainDetailResponse.getData(); - List items = trainDetailData.getItems(); - TrainDetailResponse.Item item = null; - TrainDetailResponse.ChangeInfo changeInfo = null; - if (!trainDetailData.getItems().isEmpty()) { - item = items.get(0); - changeInfo = item.getChangeInfo(); - } - - TrainDetailResponse.ChangeItem changeItem = null; - if (changeInfo != null) { - changeItem = changeInfo.getChangeItem(); - } - - Optional byOrderNo = orderDetailRepository.findByOrderNo(trainDetailData.getOrderNo()); - - TrainOrderDetail trainOrderDetail; - if (byOrderNo.isPresent()) { - if (byOrderNo.get().getTrainOrderDetail() == null) { - trainOrderDetail = new TrainOrderDetail(); - } else { - return byOrderNo.get().getTrainOrderDetail(); - } - } else { - trainOrderDetail = new TrainOrderDetail(); - } - - OrderDetail orderDetail = byOrderNo.get(); - RouteOrder routeOrder = routeRepository.queryById(byOrderNo.get().getRouteId()); - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - - trainOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } - } - - - if (trainDetailData != null) { - trainOrderDetail.setOrderNo(trainDetailData.getOrderNo()); - trainOrderDetail.setDetailId(trainDetailData.getOrderNo()); - trainOrderDetail.setParentOrderNo(trainDetailData.getParentOrderSerialNo()); - - Optional first1 = routeOrder - .getOrderDetails() - .stream() - .filter(it -> it.getOrderNo().equals(trainDetailData.getOrderNo())) - .findFirst(); - - first1.ifPresent(it -> { - OrderEvent lastEvent = it.getLastEvent(); - if (trainDetailData.getIsChangedOrder().equals(1)) { - trainOrderDetail.setOrderStatus(FSSC_TRAIN_STATUS_CHANGE); - } - if (lastEvent != null) { - trainOrderDetail.setOrderStatus(lastEvent.mapToTrainOrderDetailStatus()); - } else { - //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 - String orderStatus = trainDetailData.getOrderStatus(); - trainOrderDetail.setOrderStatus( - OrderEvent.mapToTrainOrderDetailStatus( - LYOrderUtil.mapTrainStatus(orderStatus) - ) - ); - } - if (!trainOrderDetail.getOrderStatus().equals(FSSC_TRAIN_STATUS_CHANGE) - && !trainOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)) { - trainOrderDetail.setOrderStatus(FSSC_TRAIN_STATUS_SUCCESS); - } - } - ); - String EmployeeNo = routeOrder.getUserId(); - User user = userRepository.findByUserEmployeeNo(EmployeeNo); - if (user != null) { - trainOrderDetail.setBookingUserCode(user.getEmployeeNo()); - trainOrderDetail.setBookingName(user.getName()); - trainOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - } - trainOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); - trainOrderDetail.setCreateTime(trainDetailData.getOutTicketTime()); - trainOrderDetail.setStartTime(trainDetailData.getPlanBeginDate()); - trainOrderDetail.setArriveTime(trainDetailData.getPlanEndDate()); - trainOrderDetail.setFromStationName(trainDetailData.getFromStation()); - trainOrderDetail.setToStationName(trainDetailData.getToStation()); - trainOrderDetail.setTrainNo(trainDetailData.getTrainNo()); - trainOrderDetail.setFromCity(trainDetailData.getDepartCity()); - trainOrderDetail.setToCity(trainDetailData.getArriveCity()); - trainOrderDetail.setOrderAmount(String.valueOf(trainDetailData.getTotalAmount())); - trainOrderDetail.setPersonalAmount(trainDetailData.getPersonalPrice().toString()); - trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString()); - trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode()); - trainOrderDetail.setPaymentType(trainDetailData.getPaymentType().toString()); - List submitItemList = - trainDetailData.getTravelData().getSubmitItemList(); - - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - if (approveOrderNo != null) { - trainOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - trainOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - trainOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); - trainOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); - } - } - - if (item != null) { - trainOrderDetail.setPreServiceFee(String.valueOf(item.getServiceCharge())); - trainOrderDetail.setPostServiceFee(String.valueOf(item.getAfterServiceCharge())); - trainOrderDetail.setRefundAmount(String.valueOf(item.getRefundAmountCor())); - - if (item.getSeatClass().equals("secondseat")) { - trainOrderDetail.setSeatType("二等座"); - } - if (item.getSeatClass().equals("businessseat")) { - trainOrderDetail.setSeatType("商务座"); - } - if (item.getSeatClass().equals("hardseat")) { - trainOrderDetail.setSeatType("硬座"); - } - if (item.getSeatClass().equals("softsleeperup")) { - trainOrderDetail.setSeatType("软卧"); - } - if (item.getSeatClass().equals("hardsleeperup")) { - trainOrderDetail.setSeatType("硬卧"); - } - if (item.getSeatClass().equals("firstseat")) { - trainOrderDetail.setSeatType("一等座"); - } - - - trainOrderDetail.setSeatName(item.getSeatNo()); - trainOrderDetail.setTicketPrice(String.valueOf(item.getTicketPrice())); - trainOrderDetail.setRefundCost(String.valueOf(item.getRefundFee())); - trainOrderDetail.setRefundPrice(String.valueOf(item.getRefundAmountCor())); - trainOrderDetail.setChangeCost(String.valueOf(item.getServiceCharge())); - trainOrderDetail.setPhone(item.getPassengerPhone()); - trainOrderDetail.setUserName(item.getPassengerName()); - } - - if (changeItem != null) { - trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice())); - trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice())); - } -// trainOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME); - - Optional firstOrderEvent = orderDetail.getOrderEventList() - .stream() - .map(OrderEvent::getEventType) - .filter(it -> it.equals(ORDER_EVENT_ETA)) - .findFirst(); - - if (firstOrderEvent.isEmpty()) { - trainOrderDetail.setOverStandard("否"); //无 - } else { - trainOrderDetail.setOverStandard("是"); //无 - } - - Optional first2 = orderDetail.getOrderEventList() - .stream() - .findFirst(); - first2.ifPresent(orderEvent -> trainOrderDetail.setOverStandardReason(orderEvent.getExtension())); - -// trainOrderDetail.setOriginalOrderNo("originalOrderNo"); //无 -// trainOrderDetail.setBookingUserPhone(trainDetailData.getContactInfo().getPersonMobile() != null ? -// trainDetailData.getContactInfo().getPersonMobile() : -// trainDetailData.getContactInfo().getPersonTelephone()); //不确定是否是这个字段(文档没写)猜测 -// trainOrderDetail.setScheduleNum(""); //无 -// trainOrderDetail.setRunTime(""); //无 -// trainOrderDetail.setTickets(trainDetailData.getTicketNo()); //ChangeInfo.changeItem里面的数据 -// trainOrderDetail.setStandardItems("policyName"); //无 -// trainOrderDetail.setBOOK_ORG_STRUCT_1(""); //无 -// trainOrderDetail.setBOOK_ORG_STRUCT_2(""); //无 -// trainOrderDetail.setBOOK_ORG_STRUCT_3(""); //无 -// trainOrderDetail.setInsuranceFee(""); //无 - - - return trainOrderDetail; - } - private String translateEnSeatToCnSeat(String seatEnName) { return switch (seatEnName) { case "secondseat" -> "二等座"; diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java index 2b80e82b..2499df86 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java @@ -62,12 +62,12 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { baseOrderExtension.setBookingUserPhone(user.getPhoneNumber()); //配置供应商信息 - String supplierName = routeOrder.getSupplierName(); - if (supplierName.equals(SUPPLIER_C_TRIP)) { - baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); - } else { - baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - } +// String supplierName = routeOrder.getSupplierName(); +// if (supplierName.equals(SUPPLIER_C_TRIP)) { +// baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); +// } else { +// baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); +// } ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); if (approveOrderNo != null) { diff --git a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java index 83f99b58..8f0f2ff0 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java @@ -17,52 +17,52 @@ public class OrderRecordFactory { @Autowired private UserRepository userRepository; - public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) { - routeOrder.reloadStatus(); - OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); - - //完成身份信息 - String userId = routeOrder.getUserId(); - User user = userRepository.findByUserEmployeeNo(userId); - orderRecordBasic.loadBookingInfo(user.getEmployeeNo(), - user.getName(), - user.getPhoneNumber(), - user.getEmployeeNo(), - user.getPhoneNumber()); - - - //配置供应商信息 - String supplierName = routeOrder.getSupplierName(); - if (supplierName.equals(SUPPLIER_C_TRIP)) { - orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); - } else { - orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - } - - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - if (approveOrderNo != null) { - orderRecordBasic.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - orderRecordBasic.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - orderRecordBasic.setProjectOrderNo(approveOrderNo.getProjectName()); - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } - } else { - orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); - } - } - return orderRecordBasic; - } +// public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) { +// routeOrder.reloadStatus(); +// OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); +// +// //完成身份信息 +// String userId = routeOrder.getUserId(); +// User user = userRepository.findByUserEmployeeNo(userId); +// orderRecordBasic.loadBookingInfo(user.getEmployeeNo(), +// user.getName(), +// user.getPhoneNumber(), +// user.getEmployeeNo(), +// user.getPhoneNumber()); +// +// +// //配置供应商信息 +// String supplierName = routeOrder.getSupplierName(); +// if (supplierName.equals(SUPPLIER_C_TRIP)) { +// orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); +// } else { +// orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); +// } +// +// ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); +// if (approveOrderNo != null) { +// orderRecordBasic.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); +// orderRecordBasic.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); +// orderRecordBasic.setProjectOrderNo(approveOrderNo.getProjectName()); +// String sysCode = routeOrder.getApproveOrderNo().getSysCode(); +// if (sysCode != null) { +// if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { +// orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); +// } +// if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { +// orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); +// } +// if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { +// orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); +// } +// if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { +// orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); +// } +// } else { +// orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); +// } +// } +// return orderRecordBasic; +// } } diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 07743b13..61c44b5e 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -7,7 +7,6 @@ import com.chint.domain.repository.LegRepository; import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; -import com.chint.infrastructure.constant.LegConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,6 +15,7 @@ import java.util.List; import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR; import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.OrderConstant.*; +import static com.chint.infrastructure.constant.RouteConstant.APPROVAL_EVENT_PREPARE; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; @Service @@ -70,8 +70,7 @@ public class LegDomainService { } - - if(leg.getLegStatus().equals(LEG_STATUS_CHANGE)){ + if (leg.getLegStatus().equals(LEG_STATUS_CHANGE)) { //如果发现该订单 LegEvent legEvent = legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL); leg.addEvent(legEvent); @@ -141,4 +140,24 @@ public class LegDomainService { }); return list; } + + public RouteOrder checkLegIfStartApproval(RouteOrder routeOrder) { + routeOrder.reloadStatus(); + List legItems = routeOrder.getLegItems(); + legItems.forEach(it -> { + if (!routeOrder.getApprovalStatusCode().equals(APPROVAL_EVENT_PREPARE) && it.getLegStatus().equals(LEG_STATUS_PREPARE)) { + it.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)); + } + }); + return routeOrder; + } + + public List queryLegsCanSync(RouteOrder routeOrder, String supplierName) { + List legItems = routeOrder.getLegItems(); + legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList(); + if (supplierName.equals("CTrip")) { + legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_TRAIN)).toList(); + } + return legItems; + } } diff --git a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java index 1f09e8b7..f4e0db81 100644 --- a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java +++ b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java @@ -1,9 +1,8 @@ package com.chint.domain.service; -import com.chint.domain.aggregates.order.Leg; -import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.order.RouteRequest; -import com.chint.domain.aggregates.order.RouteRequestEvent; +import com.chint.domain.aggregates.order.*; +import com.chint.domain.exceptions.CommandException; +import com.chint.domain.factoriy.leg_event.LegEventFactory; import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.repository.LegRepository; import com.chint.domain.repository.RouteRepository; @@ -16,6 +15,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; +import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.RouteRequestConstant.ROUTE_REQUEST_STATUS_PREPARE; @Service @@ -39,9 +39,27 @@ public class RouteRequestDomainService { @Autowired private RouteRequestRepository routeRequestRepository; + @Autowired + private LegEventFactory legEventFactory; + + +// //这里增加一个判断 ,如果这个订单的行程为空,那么就返回给用户提示 +// if (legItems == null || legItems.isEmpty()) { +// throw new CommandException("订单的行程不能为空"); +// } +// List needSyncLegs = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList(); +// if (needSyncLegs.isEmpty()) { +// throw new CommandException("有所选的行程规划单不存在需要同步的行程"); +// } +// +// //这里order所有的leg触发sync事件 +// legItems.forEach(leg -> leg.getEventList().add( +// legEventFactory.creatLegEvent(command.getLegEventType()) +// )); public RouteRequest syncRouteRequestToSupplier(SyncLegData syncLegData) { RouteOrder routeOrder = routeRepository.queryById(syncLegData.getRouteId()); + legDomainService.checkLegIfStartApproval(routeOrder); List legIds = syncLegData.getLegIds(); RouteRequest routeRequest = getRouteRequest(routeOrder, legIds, syncLegData.getSupplierName()); if (routeRequest.getStatus().equals(ROUTE_REQUEST_STATUS_PREPARE)) { @@ -53,8 +71,26 @@ public class RouteRequestDomainService { //如果是不是刚生成的,需要调整差旅申请单的行程 loadLegInfo(routeRequest, routeOrder, legIds); } + + List legs = routeRequest.getRouteRequestLegList() + .stream() + .map(RouteRequestLeg::getLeg) + .toList(); + + if (legs.isEmpty()) { + throw new CommandException("订单的行程不能为空"); + } + + List needSyncLegs = legs.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList(); + if (needSyncLegs.isEmpty()) { + throw new CommandException("有所选的行程规划单不存在需要同步的行程"); + } + + legs.forEach(it -> it.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_NOT_ORDERED))); + //这里执行同步 syncAdapter.of(syncLegData.getSupplierName()).syncRouteRequest(routeRequest); routeRequest.addEvent(RouteRequestEvent.sync(syncLegData.getSupplierName())); + //通过保存聚合根来保存差旅申请单 routeRepository.save(routeOrder); return routeRequest; @@ -79,7 +115,10 @@ public class RouteRequestDomainService { } optionalRouteRequest.ifPresent(it -> { it.addEvent(RouteRequestEvent.cancel(it.getSupplier())); + getLegInfoFromRouteOrder(it, routeOrder); syncAdapter.of(it.getSupplier()).cancelRouteRequest(it); + it.getRouteRequestLegList() + .forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL))); }); routeRepository.save(routeOrder); } @@ -105,15 +144,27 @@ public class RouteRequestDomainService { //获取目前已经同步到供应商的差旅申请单 private RouteRequest loadLegInfo(RouteRequest routeRequest, RouteOrder routeOrder, List legIds) { List legItems = routeOrder.getLegItems(); - routeRequest.getRouteRequestLegList().forEach(it -> - legItems.stream() - .filter(leg -> legIds.contains(leg.getLegId())) - .filter(leg -> leg.getLegId().equals(it.getLegId())) - .findFirst() - .ifPresent(it::setLeg)); + List list = legItems.stream() + .filter(leg -> legIds.contains(leg.getLegId())) + .map(RouteRequestLeg::ofLeg) + .toList(); + routeRequest.setRouteRequestLegList(list); return routeRequest; } + private RouteRequest getLegInfoFromRouteOrder(RouteRequest routeRequest, RouteOrder routeOrder) { + List legItems = routeOrder.getLegItems(); + routeRequest.getRouteRequestLegList().forEach(it -> { + for (Leg leg : legItems) { + if (leg.getLegId().equals(it.getLegId())) { + it.setLeg(leg); + } + } + }); + return routeRequest; + } + + public RouteOrder getRouteOrder(String journeyNo) { RouteOrder byOrderNo = routeRepository.findByOrderNo(journeyNo); if (byOrderNo == null) { @@ -122,4 +173,6 @@ public class RouteRequestDomainService { } return byOrderNo; } + + } diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index e6a7202d..f084a448 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -321,8 +321,15 @@ public class LegEventHandler implements LegEventService { .stream() .filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)) .toList(); - if (!list.isEmpty() && !syncAdapter.of(routeOrder.getSupplierName()).cancelSyncSupplierOrder(routeOrder)) { - throw new CommandException("订单取消失败"); + + List routeRequestList = routeOrder.getRouteRequestList(); + + if(routeRequestList != null && !routeRequestList.isEmpty()) { + routeRequestList.forEach(it->syncAdapter.of(it.getSupplier()).cancelRouteRequest(it)); + } else { + if (!list.isEmpty() && !syncAdapter.of(routeOrder.getSupplierName()).cancelSyncSupplierOrder(routeOrder)) { + throw new CommandException("订单取消失败"); + } } } LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); diff --git a/src/main/java/com/chint/domain/value_object/OrderQueryData.java b/src/main/java/com/chint/domain/value_object/OrderQueryData.java index 164c3bb4..955351ee 100644 --- a/src/main/java/com/chint/domain/value_object/OrderQueryData.java +++ b/src/main/java/com/chint/domain/value_object/OrderQueryData.java @@ -1,6 +1,7 @@ package com.chint.domain.value_object; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -9,6 +10,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) @Data public class OrderQueryData extends BaseQuery { + @ApiModelProperty("需要同步的行程规划单ID") private Long routeId; private String billcode; private String sysCode; @@ -17,5 +19,6 @@ public class OrderQueryData extends BaseQuery { private String orderNo; private String instructions; private String keywords; + @ApiModelProperty("供应商标识") private String supplierName; } diff --git a/src/main/java/com/chint/domain/value_object/SyncLegData.java b/src/main/java/com/chint/domain/value_object/SyncLegData.java index 9cf3460e..c3bd4df6 100644 --- a/src/main/java/com/chint/domain/value_object/SyncLegData.java +++ b/src/main/java/com/chint/domain/value_object/SyncLegData.java @@ -1,15 +1,21 @@ package com.chint.domain.value_object; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data public class SyncLegData { + @ApiModelProperty("需要同步的行程规划单ID") private Long routeId; + @ApiModelProperty("差旅申请单ID") private Long routeRequestId; + @ApiModelProperty("批量同步的行程规划单ID") private List routeIds; + @ApiModelProperty("需要同步的行程节点ID") private List legIds; + @ApiModelProperty("供应商标识") private String supplierName; public static SyncLegData of( Long routeId,String supplierName){ SyncLegData syncLegData = new SyncLegData(); diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 0e552aab..f4381294 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -48,10 +48,10 @@ logging: #正式 ly: appId: zhengtai - account: ab9fe0c19dd64a99b936fded72c3bb94 - password: glHRJJ9JMUwNfQ8OwAQi - secret: MnghmYJpM1U2RaLx - baseUrl: https://api.dttrip.cn/openapi + account: 4f9cb1080b564dd0a94aa95f7a19c8b5 + password: 1fD3SutgzfS48qznYQiq + secret: WOHzCMvHd823iHgH + baseUrl: https://api.qa.dttrip.cn/openapi ifForwardRequest: false forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz From 16fd3c32c17f77383597a9fb27667d98061eb3e9 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 9 Apr 2024 10:41:30 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=A1=8C=E7=A8=8B=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/domain/service/LegDomainService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 61c44b5e..146d77a0 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -17,6 +17,7 @@ import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.OrderConstant.*; import static com.chint.infrastructure.constant.RouteConstant.APPROVAL_EVENT_PREPARE; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; +import static com.chint.infrastructure.constant.RouteRequestConstant.ROUTE_REQUEST_STATUS_SYNC; @Service public class LegDomainService { @@ -158,6 +159,16 @@ public class LegDomainService { if (supplierName.equals("CTrip")) { legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_TRAIN)).toList(); } + + List alreadySyncLegIds = routeOrder.getRouteRequestList() + .stream() + .filter(it -> it.reloadStatus().getStatus().equals(ROUTE_REQUEST_STATUS_SYNC)) + .flatMap(it -> it.getRouteRequestLegList().stream().map(RouteRequestLeg::getLegId)) + .toList(); + + legItems = legItems.stream() + .filter(it -> !alreadySyncLegIds.contains(it.getLegId())) + .toList(); return legItems; } } From 2095abd91bff162319c12c962de19b51782bda40 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 9 Apr 2024 12:39:55 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=89=93=E8=BD=A6=E8=BD=AC=E6=8D=A2res=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/application/dtos/response/LegRes.java | 6 ++++-- .../domain/service/RouteRequestDomainService.java | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/chint/application/dtos/response/LegRes.java b/src/main/java/com/chint/application/dtos/response/LegRes.java index f1a1d49d..b0b1898e 100644 --- a/src/main/java/com/chint/application/dtos/response/LegRes.java +++ b/src/main/java/com/chint/application/dtos/response/LegRes.java @@ -70,8 +70,10 @@ public class LegRes { if (legExtensionField.getLocationIds() != null) { List locationResList = new ArrayList<>(); List locationList = legExtensionField.getLocationList(); - for (Location location : locationList) { - locationResList.add(LocationRes.copyFrom(location)); + if(locationList != null && !locationList.isEmpty()){ + for (Location location : locationList) { + locationResList.add(LocationRes.copyFrom(location)); + } } legRes.setOtherLocationList(locationResList); } diff --git a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java index f4e0db81..e26438b0 100644 --- a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java +++ b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java @@ -166,13 +166,11 @@ public class RouteRequestDomainService { public RouteOrder getRouteOrder(String journeyNo) { - RouteOrder byOrderNo = routeRepository.findByOrderNo(journeyNo); - if (byOrderNo == null) { - RouteRequest byRouteRequestNo = routeRequestRepository.findByRouteRequestNo(journeyNo); - byOrderNo = routeRepository.queryById(byRouteRequestNo.getRouteId()); + //先通过 + RouteRequest routeRequest = routeRequestRepository.findByRouteRequestNo(journeyNo); + if(routeRequest == null){ + return routeRepository.findByOrderNo(journeyNo); } - return byOrderNo; + return routeRepository.queryById(routeRequest.getRouteId()); } - - } From b33224b5f60e86dfc6d090d9a2873f6923cfcf09 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 9 Apr 2024 12:49:44 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9C=AA=E5=90=8C=E6=AD=A5=E8=A1=8C=E7=A8=8B=E8=8A=82=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=20=E5=9C=B0=E7=82=B9=E4=BF=A1=E6=81=AF=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/chint/domain/service/LegDomainService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 146d77a0..a948efab 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -36,6 +36,9 @@ public class LegDomainService { @Autowired private LocationRepository locationRepository; + @Autowired + private OrderDomainService orderDomainService; + public Leg legCheckOrder(Leg leg) { List orderDetailList = orderDetailRepository.findByLegId(leg.getLegId()); orderDetailList.forEach(OrderDetail::reloadStatus); @@ -169,6 +172,8 @@ public class LegDomainService { legItems = legItems.stream() .filter(it -> !alreadySyncLegIds.contains(it.getLegId())) .toList(); + + queryLocation(legItems); return legItems; } } From 2005e023a8bb8aec5e5217f31d6645efd77b676c Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 9 Apr 2024 12:59:20 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E4=B8=8D?= =?UTF-8?q?=E4=BC=A0=E8=A1=8C=E7=A8=8B=E8=8A=82=E7=82=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E8=A1=8C=E7=A8=8B=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/in/OrderPublicController.java | 1 + .../service/RouteRequestDomainService.java | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/chint/application/in/OrderPublicController.java b/src/main/java/com/chint/application/in/OrderPublicController.java index 160780a0..5fa4436f 100644 --- a/src/main/java/com/chint/application/in/OrderPublicController.java +++ b/src/main/java/com/chint/application/in/OrderPublicController.java @@ -81,4 +81,5 @@ public class OrderPublicController { return Result.Success(SUCCESS); } + } diff --git a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java index e26438b0..0635eb57 100644 --- a/src/main/java/com/chint/domain/service/RouteRequestDomainService.java +++ b/src/main/java/com/chint/domain/service/RouteRequestDomainService.java @@ -144,10 +144,17 @@ public class RouteRequestDomainService { //获取目前已经同步到供应商的差旅申请单 private RouteRequest loadLegInfo(RouteRequest routeRequest, RouteOrder routeOrder, List legIds) { List legItems = routeOrder.getLegItems(); - List list = legItems.stream() - .filter(leg -> legIds.contains(leg.getLegId())) - .map(RouteRequestLeg::ofLeg) - .toList(); + List list; + if (legIds != null && !legIds.isEmpty()) { + list = legItems.stream() + .filter(leg -> legIds.contains(leg.getLegId())) + .map(RouteRequestLeg::ofLeg) + .toList(); + } else { + list = legItems.stream() + .map(RouteRequestLeg::ofLeg) + .toList(); + } routeRequest.setRouteRequestLegList(list); return routeRequest; } @@ -168,8 +175,8 @@ public class RouteRequestDomainService { public RouteOrder getRouteOrder(String journeyNo) { //先通过 RouteRequest routeRequest = routeRequestRepository.findByRouteRequestNo(journeyNo); - if(routeRequest == null){ - return routeRepository.findByOrderNo(journeyNo); + if (routeRequest == null) { + return routeRepository.findByOrderNo(journeyNo); } return routeRepository.queryById(routeRequest.getRouteId()); }