diff --git a/src/main/java/com/chint/application/commands/LegFinishedCommand.java b/src/main/java/com/chint/application/commands/LegFinishedCommand.java index 2c839368..10fe5dfc 100644 --- a/src/main/java/com/chint/application/commands/LegFinishedCommand.java +++ b/src/main/java/com/chint/application/commands/LegFinishedCommand.java @@ -1,17 +1,15 @@ package com.chint.application.commands; -import com.chint.domain.value_object.ApproveLegData; import com.chint.domain.value_object.FinishLegData; import com.chint.infrastructure.echo_framework.command.Command; import lombok.Data; -import static com.chint.infrastructure.constant.Constant.LEG_EVENT_APPROVAL; import static com.chint.infrastructure.constant.Constant.LEG_EVENT_FINISH; @Data public class LegFinishedCommand extends Command { - private Integer LegEventType = LEG_EVENT_FINISH; - private Long LegId; + private final Integer legEventType = LEG_EVENT_FINISH; + private Long legId; private FinishLegData data; public LegFinishedCommand legId(Long LegId) { diff --git a/src/main/java/com/chint/application/commands/LegOrderedCommand.java b/src/main/java/com/chint/application/commands/LegOrderedCommand.java index c5d5ee63..1af8a81e 100644 --- a/src/main/java/com/chint/application/commands/LegOrderedCommand.java +++ b/src/main/java/com/chint/application/commands/LegOrderedCommand.java @@ -1,27 +1,24 @@ package com.chint.application.commands; -import com.chint.domain.value_object.ApproveLegData; -import com.chint.domain.value_object.FinishLegData; import com.chint.domain.value_object.OrderLegData; import com.chint.infrastructure.echo_framework.command.Command; import lombok.Data; -import static com.chint.infrastructure.constant.Constant.LEG_EVENT_APPROVAL; import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED; @Data public class LegOrderedCommand extends Command { private Integer LegEventType = LEG_EVENT_ORDERED; private Long LegId; - private OrderLegData data; + private Long orderDetailId; public LegOrderedCommand legId(Long LegId) { this.setLegId(LegId); return this; } - public LegOrderedCommand data(OrderLegData data) { - this.data = data; + public LegOrderedCommand orderDetailId(Long orderDetailId) { + this.setOrderDetailId(orderDetailId); return this; } } diff --git a/src/main/java/com/chint/application/commands/LegRejectCommand.java b/src/main/java/com/chint/application/commands/LegRejectCommand.java index e9185762..6c779e12 100644 --- a/src/main/java/com/chint/application/commands/LegRejectCommand.java +++ b/src/main/java/com/chint/application/commands/LegRejectCommand.java @@ -1,9 +1,25 @@ package com.chint.application.commands; +import com.chint.domain.value_object.ApproveLegData; +import com.chint.domain.value_object.RejectLegData; import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; -import static com.chint.infrastructure.constant.Constant.LEG_EVENT_NOT_ORDERED; +import static com.chint.infrastructure.constant.Constant.LEG_EVENT_REJECT; +@Data public class LegRejectCommand extends Command { - private Integer LegEventType = LEG_EVENT_NOT_ORDERED; + private final Integer legEventType = LEG_EVENT_REJECT; + private Long routeId; + private RejectLegData data; + + public LegRejectCommand routeId(Long routeId) { + this.setRouteId(routeId); + return this; + } + + public LegRejectCommand data(RejectLegData data) { + this.data = data; + return this; + } } diff --git a/src/main/java/com/chint/application/commands/RouteAddOrderCommand.java b/src/main/java/com/chint/application/commands/RouteAddOrderCommand.java new file mode 100644 index 00000000..32591f89 --- /dev/null +++ b/src/main/java/com/chint/application/commands/RouteAddOrderCommand.java @@ -0,0 +1,17 @@ +package com.chint.application.commands; + +import com.chint.domain.value_object.OrderLegData; +import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; + +import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED; + +@Data +public class RouteAddOrderCommand extends Command { + private Integer LegEventType = LEG_EVENT_ORDERED; + private OrderLegData data; + public RouteAddOrderCommand data(OrderLegData data) { + this.data = data; + return this; + } +} diff --git a/src/main/java/com/chint/application/in/OrderController.java b/src/main/java/com/chint/application/in/OrderController.java index ea6453af..bca884dc 100644 --- a/src/main/java/com/chint/application/in/OrderController.java +++ b/src/main/java/com/chint/application/in/OrderController.java @@ -51,4 +51,20 @@ public class OrderController { return Result.Success(SUCCESS); } + @Transactional + @ApiOperation("修改规划节点关联的订单") + @PostMapping("/leg/update") + public Result updateLegOrder(@RequestBody UpdateLegData updateLegData) { + orderApplicationService.orderedToLeg(updateLegData); + return Result.Success(SUCCESS); + } + + @Transactional + @ApiOperation("审批拒绝行程规划单") + @PostMapping("/reject") + public Result rejectOrder(@RequestBody RejectLegData rejectLegData) { + orderApplicationService.reject(rejectLegData); + return Result.Success(SUCCESS); + } + } diff --git a/src/main/java/com/chint/application/out/SupplierLoginController.java b/src/main/java/com/chint/application/out/SupplierLoginController.java index e83d1359..f57cb795 100644 --- a/src/main/java/com/chint/application/out/SupplierLoginController.java +++ b/src/main/java/com/chint/application/out/SupplierLoginController.java @@ -4,6 +4,7 @@ package com.chint.application.out; import com.chint.application.services.SupplierLoginService; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.ctrip.dto.login.H5Response; +import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -20,7 +21,7 @@ public class SupplierLoginController { @Autowired private SupplierLoginService supplierLoginService; - @ApiOperation("单点登录同程") + @ApiOperation("单点登录同程-移动") @PostMapping("/ly/login") public Result lyLogin() { //登录 @@ -28,10 +29,24 @@ public class SupplierLoginController { return Result.Success(SUCCESS, data); } - @ApiOperation("单点登录携程") + @ApiOperation("单点登录同程-PC") + @PostMapping("/ly/login/pc") + public Result lyLoginPC() { + //登录 + LYRedirectUrlResponse data = supplierLoginService.lyLoginPC(); + return Result.Success(SUCCESS, data); + } + + @ApiOperation("单点登录携程-移动") @PostMapping("/CTrip/login") public Result cTripLogin() { return Result.Success(SUCCESS, supplierLoginService.cTripLogin()); } + @ApiOperation("单点登录携程-PC") + @PostMapping("/CTrip/login/pc") + public Result cTripLoginPC() { + return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC()); + } + } diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index bf7fe6f1..54737b58 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -1,9 +1,9 @@ package com.chint.application.services; import com.chint.application.commands.*; -import com.chint.domain.aggregates.order.Leg; import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.exceptions.NotFoundException; +import com.chint.domain.exceptions.OrderException; import com.chint.domain.factoriy.leg.LegFactory; import com.chint.domain.factoriy.order.OrderFactory; import com.chint.domain.repository.RouteRepository; @@ -16,7 +16,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Optional; -import static com.chint.infrastructure.constant.Constant.NOT_FOUND; +import static com.chint.infrastructure.constant.Constant.*; @Service public class OrderApplicationService { @@ -37,18 +37,18 @@ public class OrderApplicationService { public RouteOrder saveOrder(OrderSaveData orderSaveData) { RouteOrder order; if (orderSaveData.getRouteId() != null) { - order = Optional.ofNullable(routeRepository.queryById(orderSaveData.getRouteId())) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + order = Optional.ofNullable(routeRepository.queryById(orderSaveData.getRouteId())).orElseThrow(() -> new NotFoundException(NOT_FOUND)); order.reloadStatus(orderSaveData, legFactory); + if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { + throw new OrderException(DATA_INVALID); + } } else { // order = orderFactory.createOrder(orderSaveData); throw new NotFoundException(NOT_FOUND); } RouteOrder routeOrder = orderDomainService.saveOrder(order); //这里保存订单之后,需要为每个新添加的leg执行规划中事件 - routeOrder.getLegItems().forEach(leg -> - Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue() - ); + routeOrder.getLegItems().forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); return routeOrder; } @@ -63,17 +63,30 @@ public class OrderApplicationService { } @Transactional - public void ordered(Long legId, OrderLegData data){ - Command.of(LegOrderedCommand.class).legId(legId).data(data).sendToQueue(); + public void ordered(OrderLegData data) { + Command.of(RouteAddOrderCommand.class).data(data).sendToQueue(); } @Transactional - public void payed(Long legId, PayLegData data){ + public void orderedToLeg(UpdateLegData updateLegData) { + Command.of(LegOrderedCommand.class) + .legId(updateLegData.getLegId()) + .orderDetailId(updateLegData.getOrderDetailId()) + .sendToQueue(); + } + + @Transactional + public void payed(Long legId, PayLegData data) { Command.of(LegPayedCommand.class).legId(legId).data(data).sendToQueue(); } @Transactional - public void finished(Long legId, FinishLegData data){ + public void finished(Long legId, FinishLegData data) { Command.of(LegFinishedCommand.class).legId(legId).data(data).sendToQueue(); } + + @Transactional + public void reject(RejectLegData data) { + Command.of(LegRejectCommand.class).data(data).sendToQueue(); + } } diff --git a/src/main/java/com/chint/application/services/SupplierLoginService.java b/src/main/java/com/chint/application/services/SupplierLoginService.java index 56420150..22fb0459 100644 --- a/src/main/java/com/chint/application/services/SupplierLoginService.java +++ b/src/main/java/com/chint/application/services/SupplierLoginService.java @@ -2,10 +2,12 @@ package com.chint.application.services; import com.chint.interfaces.rest.ctrip.CTripLoginRequest; import com.chint.interfaces.rest.ctrip.dto.login.H5Response; +import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; import com.chint.interfaces.rest.ly.LYLoginRequest; import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.yaml.snakeyaml.extensions.compactnotation.PackageCompactConstructor; import static com.chint.infrastructure.constant.Constant.L_Y_ENTRANCE_HOME; @@ -15,7 +17,6 @@ public class SupplierLoginService { @Autowired private LYLoginRequest lyLoginRequest; - @Autowired private CTripLoginRequest cTripLoginRequest; @@ -26,7 +27,14 @@ public class SupplierLoginService { return lyLoginRequest.login(L_Y_ENTRANCE_HOME); } + public LYRedirectUrlResponse lyLoginPC() { + return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME); + } + public H5Response cTripLogin() { return cTripLoginRequest.hSingleLogin(); } + public PCResponse cTripLoginPC() { + return cTripLoginRequest.authLogin(); + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java index f6008f5e..d5002921 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Leg.java +++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java @@ -52,10 +52,13 @@ public class Leg { private Integer legStatus; @Transient private String legStatusName; + @Transient + private OrderDetail orderDetail; //这个属性不做持久化保存 ,根据下单事件进行获取 @MappedCollection(idColumn = "leg_id", keyColumn = "leg_key") private List eventList; + public Leg(Long legId) { this.legId = legId; } @@ -84,8 +87,17 @@ public class Leg { this.legStatus = latestEvent.getEventType(); // If the latest event is an order event, update the amount - if (latestEvent.getEventType().equals(LEG_EVENT_ORDERED)) { - this.amount = latestEvent.getOrderDetail().getAmount(); + if (latestEvent.getEventType() >= LEG_EVENT_ORDERED) { + //获取最新的下单事件 + LegEvent latestOrderEvent = this.eventList + .stream() + .filter(legEvent -> legEvent.getEventType().equals(LEG_EVENT_ORDERED)) + .max(Comparator.comparingLong(LegEvent::getLegEventId)) + .orElse(null); + Optional.ofNullable(latestOrderEvent.getOrderDetail()).ifPresent(detail -> { + this.amount = detail.getPrice(); + this.orderDetail = detail; + }); } } @@ -152,17 +164,17 @@ public class Leg { } // 事件类型为负数,代表是可以任何时机都可进行的事件 - if(event.getEventType() < 0) { + if (event.getEventType() < 0) { eventList.add(event); return this; } - // 如果列表不为空,确保新事件的类型是按顺序的 + // 如果列表不为空,确保新事件的类型是按顺序的或者与最后一个事件类型相同 if (!eventList.isEmpty()) { LegEvent lastEvent = eventList.get(eventList.size() - 1); int lastEventType = lastEvent.getEventType(); - if (newEventType != lastEventType + 1) { - throw new LegEventException("Events must be added in sequence."); + if (newEventType != lastEventType && newEventType != lastEventType + 1) { + throw new LegEventException("New event must be the same as the last event type or the next in sequence."); } } diff --git a/src/main/java/com/chint/domain/aggregates/order/LegEvent.java b/src/main/java/com/chint/domain/aggregates/order/LegEvent.java index 00178b06..c16fcfea 100644 --- a/src/main/java/com/chint/domain/aggregates/order/LegEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/LegEvent.java @@ -4,7 +4,7 @@ import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.relational.core.mapping.Column; -import org.springframework.data.relational.core.mapping.Embedded; +import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; import java.time.LocalDateTime; @@ -25,7 +25,7 @@ public class LegEvent { private LocalDateTime happenTime; - @Embedded.Nullable + @MappedCollection(idColumn = "order_id") private OrderDetail orderDetail; public String translateLegEvent(int event) { @@ -40,4 +40,14 @@ public class LegEvent { default -> "未知事件"; }; } + + public LegEvent reloadStatus() { + this.setEventName(translateLegEvent(this.eventType)); + return this; + } + + public LegEvent orderDetail(OrderDetail orderDetail) { + this.setOrderDetail(orderDetail); + return this; + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index c4c20f40..c7684599 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -1,11 +1,41 @@ package com.chint.domain.aggregates.order; import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.time.LocalDateTime; @Data +@Table("order_detail") public class OrderDetail { - + @Id + private Long orderId; // 使用 order_id 作为主键 private String orderNo; + private String supplierName; + private String productName; // 产品名称 + private Integer productType; // 商品类型 + private Integer quantity; // 数量 + private String price; // 价格 + private Long destinationId; + private Long originId; + private LocalDateTime startTime; + private LocalDateTime endTime; + private LocalDateTime createTime; + private LocalDateTime updateTime; + // 根据需要添加构造函数、getter、setter等 - private String amount; -} + public static OrderDetail of(String orderNo, String supplierName) { + OrderDetail orderDetail = new OrderDetail(); + orderDetail.setOrderNo(orderNo); + orderDetail.setSupplierName(supplierName); + orderDetail.setCreateTime(LocalDateTime.now()); + orderDetail.setUpdateTime(LocalDateTime.now()); + return orderDetail; + } + + public OrderDetail productType(Integer productType) { + this.setProductType(productType); + return this; + } +} \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index b8a12cf8..3e0aadad 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -54,7 +54,10 @@ public class RouteOrder extends BaseEntity { private String supplierName; @MappedCollection(idColumn = "route_id", keyColumn = "route_order_key") - public List legItems; + private List legItems; + + @MappedCollection(idColumn = "route_id", keyColumn = "route_order_key") + private List orderDetails; // public void addItemAtPosition(Leg newItem) { @@ -91,6 +94,11 @@ public class RouteOrder extends BaseEntity { return this; } + public RouteOrder addOrderDetail(OrderDetail orderDetail) { + this.orderDetails.add(orderDetail); + return this; + } + public RouteOrder reloadStatus() { this.getLegItems().forEach(Leg::reloadStatus); this.estimateAmount = this.getLegItems() @@ -166,6 +174,8 @@ public class RouteOrder extends BaseEntity { this.orderStatus = 2; } else if (allItemsInStatus(1)) { this.orderStatus = 1; + } else if (allItemsInStatus(-1)) { + this.orderStatus = -1; } else { this.orderStatus = 0; // 或其他适当的默认状态 } diff --git a/src/main/java/com/chint/domain/exceptions/OrderException.java b/src/main/java/com/chint/domain/exceptions/OrderException.java new file mode 100644 index 00000000..12445b60 --- /dev/null +++ b/src/main/java/com/chint/domain/exceptions/OrderException.java @@ -0,0 +1,7 @@ +package com.chint.domain.exceptions; + +public class OrderException extends BaseException{ + public OrderException(String msg) { + super(msg); + } +} diff --git a/src/main/java/com/chint/domain/factoriy/leg_event/LegEventFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/leg_event/LegEventFactoryImpl.java index fc99d558..d3f2548e 100644 --- a/src/main/java/com/chint/domain/factoriy/leg_event/LegEventFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/leg_event/LegEventFactoryImpl.java @@ -3,12 +3,15 @@ package com.chint.domain.factoriy.leg_event; import com.chint.domain.aggregates.order.LegEvent; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; + @Component public class LegEventFactoryImpl implements LegEventFactory{ @Override public LegEvent creatLegEvent(Integer eventType) { LegEvent legEvent = new LegEvent(); legEvent.setEventType(eventType); + legEvent.setHappenTime(LocalDateTime.now()); return legEvent; } } 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 new file mode 100644 index 00000000..a0d14530 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java @@ -0,0 +1,8 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.value_object.OrderLegData; + +public interface OrderDetailFactory { + OrderDetail create(OrderLegData orderLegData); +} 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 new file mode 100644 index 00000000..ee72a57b --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java @@ -0,0 +1,13 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.value_object.OrderLegData; +import org.springframework.stereotype.Component; + +@Component +public class OrderDetailFactoryImpl implements OrderDetailFactory { + @Override + public OrderDetail create(OrderLegData orderLegData) { + return OrderDetail.of(orderLegData.getOrderNo(), orderLegData.getSupplierName()); + } +} diff --git a/src/main/java/com/chint/domain/repository/OrderDetailRepository.java b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java new file mode 100644 index 00000000..956eabf5 --- /dev/null +++ b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java @@ -0,0 +1,7 @@ +package com.chint.domain.repository; + +import com.chint.domain.aggregates.order.OrderDetail; + +public interface OrderDetailRepository { + OrderDetail findById(Long orderDetailId); +} diff --git a/src/main/java/com/chint/domain/repository/RouteRepository.java b/src/main/java/com/chint/domain/repository/RouteRepository.java index 6c195797..d94b1bc8 100644 --- a/src/main/java/com/chint/domain/repository/RouteRepository.java +++ b/src/main/java/com/chint/domain/repository/RouteRepository.java @@ -9,6 +9,8 @@ public interface RouteRepository { RouteOrder findByFakeOrderNo(String fakeOrderNo); + RouteOrder findByActualOrderNo(String actualOrderNo); + RouteOrder save(RouteOrder routeOrder); PageResult pageQuery(OrderQueryData orderQueryData); 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 edd1b9f1..ad1882fd 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 @@ -4,7 +4,9 @@ import com.chint.application.commands.*; 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_detail.OrderDetailFactory; import com.chint.domain.repository.LegRepository; +import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; import com.chint.domain.service.order_sync.SyncAdapter; import com.chint.domain.value_object.ApproveLegData; @@ -19,7 +21,7 @@ import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_APPROVAL; import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_PREPARE; @Service -public class LegEventHandler implements LegEventService{ +public class LegEventHandler implements LegEventService { @Autowired private SyncAdapter syncAdapter; @@ -33,6 +35,12 @@ public class LegEventHandler implements LegEventService{ @Autowired private LegEventFactory legEventFactory; + @Autowired + private OrderDetailFactory orderDetailFactory; + + @Autowired + private OrderDetailRepository orderDetailRepository; + @Transactional @Override public void prepareLeg(LegPrepareCommand command) { @@ -43,6 +51,7 @@ public class LegEventHandler implements LegEventService{ legRepository.save(leg); } } + @Transactional @Override public void approveLeg(LegApprovalCommand command) { @@ -65,6 +74,7 @@ public class LegEventHandler implements LegEventService{ throw new CommandException("订单未初始化"); } } + @Transactional @Override public void syncLeg(LegSyncCommand command) { @@ -86,19 +96,49 @@ public class LegEventHandler implements LegEventService{ throw new CommandException("订单未提交审批"); } } + + @Transactional + @Override + public void routeAddOrder(RouteAddOrderCommand command) { + OrderLegData data = command.getData(); + //首先查询到 行程规划订单 , 为形成规划订单添加 外部订单信息 + OrderDetail orderDetail = orderDetailFactory.create(data).productType(data.getProductType()); + String actualOrderNo = data.getActualOrderNo(); + RouteOrder routeOrder = routeRepository.findByActualOrderNo(actualOrderNo); + routeOrder.addOrderDetail(orderDetail); + //结合外部订单信息,筛选最合适的leg节点 ,触发下单事件 ; + routeOrder.getLegItems() + .stream() + .filter(leg -> leg.getLegType().equals(orderDetail.getProductType()) + && leg.getDestinationId().equals(orderDetail.getDestinationId()) + && leg.getOriginId().equals(orderDetail.getOriginId()) + && leg.getStartTime().isBefore(orderDetail.getStartTime()) + && leg.getEndTime().isAfter(orderDetail.getEndTime())) + .findFirst() + .ifPresent(leg -> { + LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); + legEvent.setOrderDetail(orderDetail); + leg.addEvent(legEvent); + }); + routeRepository.save(routeOrder); + } + @Transactional @Override public void orderLeg(LegOrderedCommand command) { - OrderLegData data = command.getData(); + //如果筛选事件可能会是错误,需要用户手动添加并修改事件 , 因此会进行额外出发修改下单事件。 Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); - LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); - OrderDetail orderDetail = new OrderDetail(); - orderDetail.setAmount(data.getOrderNo()); - orderDetail.setAmount(data.getAmount()); - legEvent.setOrderDetail(orderDetail); + + //因为orderDetail已经进行持久化保存 ,只需要从数据库进行查询 + OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId()); + LegEvent legEvent = legEventFactory + .creatLegEvent(command.getLegEventType()) + .orderDetail(orderDetail); leg.addEvent(legEvent); + legRepository.save(leg); } + @Transactional @Override public void payForLeg(LegPayedCommand command) { @@ -106,12 +146,11 @@ public class LegEventHandler implements LegEventService{ Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); OrderDetail orderDetail = new OrderDetail(); - orderDetail.setAmount(data.getOrderNo()); - orderDetail.setAmount(data.getAmount()); legEvent.setOrderDetail(orderDetail); leg.addEvent(legEvent); legRepository.save(leg); } + @Transactional @Override public void finishLeg(LegFinishedCommand command) { @@ -120,9 +159,13 @@ public class LegEventHandler implements LegEventService{ leg.addEvent(legEvent); legRepository.save(leg); } + @Transactional @Override public void rejectLeg(LegRejectCommand command) { - + RouteOrder routeOrder = routeRepository.findByActualOrderNo(command.getData().getActualOrderNo()); + LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); + routeOrder.getLegItems().forEach(leg -> leg.addEvent(legEvent)); + routeRepository.save(routeOrder); } } diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventService.java b/src/main/java/com/chint/domain/service/leg_event/LegEventService.java index c917091e..0b91d8dd 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventService.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventService.java @@ -2,19 +2,25 @@ package com.chint.domain.service.leg_event; import com.chint.application.commands.*; -import com.chint.domain.value_object.*; -import com.chint.infrastructure.echo_framework.command.Command; public interface LegEventService { void prepareLeg(LegPrepareCommand command); + //审批事件要从bpm或其他平台接收到一个真实订单 void approveLeg(LegApprovalCommand command); + void syncLeg(LegSyncCommand command); + //下单事件 void orderLeg(LegOrderedCommand command); + + void routeAddOrder(RouteAddOrderCommand command); + //付款 void payForLeg(LegPayedCommand command); + //结束 void finishLeg(LegFinishedCommand command); + void rejectLeg(LegRejectCommand command); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java b/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java index 67d2edd7..7e3d1297 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java @@ -57,6 +57,12 @@ public class LegEventServiceImpl implements LegEventService { legEventHandler.orderLeg(command); } + @ListenTo(command = "RouteAddOrderCommand", order = 0) + @Override + public void routeAddOrder(RouteAddOrderCommand command) { + legEventHandler.routeAddOrder(command); + } + @Override @ListenTo(command = "LegPayedCommand", order = 0) public void payForLeg(LegPayedCommand command) { @@ -73,9 +79,6 @@ public class LegEventServiceImpl implements LegEventService { @Override @ListenTo(command = "LegRejectCommand", order = 0) public void rejectLeg(LegRejectCommand command) { -// Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); -// LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); -// leg.addEvent(legEvent); -// legRepository.save(leg); + legEventHandler.rejectLeg(command); } } diff --git a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java index 429252a3..d18888ac 100644 --- a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java @@ -1,6 +1,7 @@ package com.chint.domain.service.order_sync; import com.chint.domain.aggregates.order.ApproveOrderNo; +import com.chint.domain.aggregates.order.Leg; import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.CityRepository; @@ -9,16 +10,22 @@ import com.chint.domain.service.OrderDomainService; import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.ctrip.CTripApprovalRequest; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest; +import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult; import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail; +import com.chint.interfaces.rest.ctrip.dto.approval.air.FlightEndorsementDetail; import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail; +import com.chint.interfaces.rest.ctrip.dto.approval.quick.CarQuickEndorsementDetail; import com.chint.interfaces.rest.ctrip.dto.approval.quick.RankInfo; +import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; -import static com.chint.infrastructure.constant.Constant.LEG_TYPE_HOTEL; +import static com.chint.infrastructure.constant.Constant.*; @Component public class CTripOrderSyncAdapter implements SupplierOrderSync { @@ -29,10 +36,6 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { @Autowired private CTripApprovalRequest approvalRequest; - @Autowired - private LocationRepository locationRepository; - - @Autowired private OrderDomainService orderDomainService; @@ -42,27 +45,85 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { User currentUser = BaseContext.getCurrentUser(); ApproveOrderNo approveOrderNo = order.getApproveOrderNo(); RankInfo rankInfo = RankInfo.of(currentUser.getRankCode()); - List cityCode = new ArrayList<>(); - List hotelList = new ArrayList<>(); - orderDomainService.queryLocation(order.getLegItems()) - .forEach( - leg -> { - cityCode.add( - cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() - ); - if (leg.getLegType().equals(LEG_TYPE_HOTEL)) { - hotelList.add( - HotelEndorsementDetail.of(cityCode.stream().distinct().toList()) - .passenger(PassengerDetail.of(String.valueOf(currentUser.getEmployeeNo()))) - .starTime(leg.getStartTime()) - .endTime(leg.getEndTime()) - ); - } - } - ); - ApprovalRequest approvalRequestParam = ApprovalRequest.buildApproval(String.valueOf(currentUser.getEmployeeNo()), approveOrderNo.getActualOrderNo(), rankInfo) - .withHotel(hotelList); - approvalRequest.approval(approvalRequestParam); - return false; + Map> collect = orderDomainService.queryLocation(order.getLegItems()) + .stream().collect(Collectors.groupingBy(Leg::getLegType)); + + ApprovalRequest approvalRequestParam = ApprovalRequest + .buildApproval(approveOrderNo.getActualOrderNo(), String.valueOf(currentUser.getEmployeeNo()), rankInfo); + + collect.forEach((k, v) -> { + switch (k) { + case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v)); + case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v)); + case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v)); + case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v)); + } + }); + + ApprovalResult approval = approvalRequest.approval(approvalRequestParam); + return approval.getSetApprovalResult().getStatus().getSuccess(); } + + private List generateHotelList(List legs) { + List hotelList = new ArrayList<>(); + legs.forEach(leg -> { + hotelList.add( + HotelEndorsementDetail.of(List.of( + cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() + )) + .passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .starTime(leg.getStartTime()) + .endTime(leg.getEndTime()) + ); + }); + return hotelList; + } + + private List generateFilghtList(List legs) { + List filghtList = new ArrayList<>(); + legs.forEach(leg -> { + filghtList.add( + FlightEndorsementDetail.of(List.of( + cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() + ), List.of( + cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity() + )) + .passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .starTime(leg.getStartTime()) + .endTime(leg.getEndTime()) + ); + }); + return filghtList; + } + + private List generateTrainList(List legs) { + List trainList = new ArrayList<>(); + legs.forEach(leg -> { + trainList.add( + TrainEndorsementDetail.of(List.of( + cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() + ), List.of( + cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity() + )).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .starTime(leg.getStartTime()) + .endTime(leg.getEndTime()) + ); + }); + return trainList; + } + + private List generateCarList(List legs) { + List carList = new ArrayList<>(); + legs.forEach(leg -> { + carList.add( + CarQuickEndorsementDetail.of(List.of( + cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() + )).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .starTime(leg.getStartTime()) + .endTime(leg.getEndTime()) + ); + }); + return carList; + } + } diff --git a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java index 5fdcbfc3..a6183f48 100644 --- a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java @@ -5,7 +5,6 @@ import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.LocationRepository; import com.chint.domain.service.OrderDomainService; -import com.chint.infrastructure.constant.Constant; import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.dto.applyordersync.*; @@ -18,21 +17,21 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import static com.chint.infrastructure.constant.Constant.L_Y_BASE_URL; +import static com.chint.infrastructure.constant.Constant.L_Y_ORDER_PATH; + @Component public class LYOrderSyncAdapter implements SupplierOrderSync { @Autowired private LYPostRequest postRequest; - @Autowired - private LocationRepository locationRepository; - @Autowired private OrderDomainService orderDomainService; @Override public boolean syncSupplierOrder(RouteOrder order) { - String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;//请求地址 + String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址 //1.设置订单参数 SupplierOrderParam param = new SupplierOrderParam();//参数 param.setOutEmployeeIdType(0);//外部员工ID类型,默认为0 @@ -52,9 +51,9 @@ public class LYOrderSyncAdapter implements SupplierOrderSync { param.setTravelDescription("同程订单");//描述信息 param.setBookableProducts("1,3,5");//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车 //2.同程的行程节点集合 - ArrayList aosItems = getAosItems(order); + List aosItems = getAosItems(order); //3.差旅人信息 - ArrayList aosPeople = new ArrayList<>(); + List aosPeople = new ArrayList<>(); AOSPerson aosPerson = new AOSPerson(); aosPerson.setName(user.getName());//用户名 aosPerson.setRelation(0);//0:内部员工,1:配偶,2:子女,3:父母,4:面试候选人,5:实习生,6:外部宾客 @@ -62,7 +61,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync { aosPerson.setOutEmployeeId(String.valueOf(user.getEmployeeNo()));//SF号(长工号) aosPeople.add(aosPerson); //4.前置差旅政策 - ArrayList aosPreTravelPolicies = new ArrayList<>(); + List aosPreTravelPolicies = new ArrayList<>(); AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy(); aosPreTravelPolicy.setPolicyCode("");//一般指客户经理提供的差旅政策标题 aosPreTravelPolicy.setProductTypeId(0);//产品ID 1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车 @@ -82,8 +81,8 @@ public class LYOrderSyncAdapter implements SupplierOrderSync { } //同程Leg集合解析 - private ArrayList getAosItems(RouteOrder order) { - ArrayList aosItems = new ArrayList<>(); + private List getAosItems(RouteOrder order) { + List aosItems = new ArrayList<>(); AOSItem aosItem = new AOSItem(); LocalDateTime startDate = LocalDateTime.MAX; LocalDateTime endDate = LocalDateTime.MIN; @@ -107,7 +106,6 @@ public class LYOrderSyncAdapter implements SupplierOrderSync { String arriveCity = leg.getDestinationLocation().getLocationName();//到达城市名 departCityStr.append(departCity).append(","); arriveCityStr.append(arriveCity).append(","); - } // 移除最后一个逗号 if (!departCityStr.isEmpty()) { diff --git a/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java new file mode 100644 index 00000000..22ad47fb --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java @@ -0,0 +1,75 @@ +package com.chint.domain.service.supplier; + +import com.chint.domain.value_object.OrderLegData; +import com.chint.domain.value_object.SupplierCallbackData; +import com.chint.interfaces.rest.ctrip.dto.search.ItineraryEntity; +import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; +import com.chint.interfaces.rest.ctrip.dto.search.car.CarOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.train.TrainOrderInfoEntity; +import org.springframework.stereotype.Component; + +import java.util.List; + +import static com.chint.infrastructure.constant.Constant.*; + + +@Component +public class CTripOrderDataAdapter implements OrderDataAdapter { + @Override + public OrderLegData adapt(SupplierCallbackData supplierData) { + //这里的查询结果的订单查询 ,需要根据订单单号来进行查询的结果,因此只会返回一个订单信息和对应的行程规划单 + SearchOrderResponse searchOrderResponse = (SearchOrderResponse) supplierData.getData(); + if (!searchOrderResponse.getItineraryList().isEmpty()) { + ItineraryEntity itineraryEntity = searchOrderResponse.getItineraryList().get(0); + + OrderLegData.Builder builder = OrderLegData.builder() + .actualOrderNo(itineraryEntity.getJourneyNO()) + .supplierName(SUPPLIER_C_TRIP); + + + } + return null; + } + + private OrderLegData.Builder findSingleElementList(ItineraryEntity itineraryEntity, + OrderLegData.Builder builder) { + List hotelOrderInfoList = itineraryEntity.getHotelOrderInfoList(); + if (hotelOrderInfoList != null && hotelOrderInfoList.size() == 1) { + HotelOrderInfoEntity hotelOrderInfoEntity = hotelOrderInfoList.get(0); + return builder.productType(LEG_TYPE_HOTEL) + .orderNo(hotelOrderInfoEntity.getOrderId()) + .price(hotelOrderInfoEntity.getAmount()); + } + // 处理航班订单 + List flightOrderInfoList = itineraryEntity.getFlightOrderInfoList(); + if (flightOrderInfoList != null && flightOrderInfoList.size() == 1) { + FlightOrderInfoEntity flightOrderInfo = flightOrderInfoList.get(0); + return builder.productType(LEG_TYPE_AIRPLANE) + .orderNo(flightOrderInfo.getBasicInfo().getOrderID()) + .price(flightOrderInfo.getFlightOrderFeeDetailList().get(0).getPayCurrency()); + } + + // 处理火车票订单 + List trainOrderInfoList = itineraryEntity.getTrainOrderInfoList(); + if (trainOrderInfoList != null && trainOrderInfoList.size() == 1) { + TrainOrderInfoEntity trainOrderInfo = trainOrderInfoList.get(0); + return builder.productType(LEG_TYPE_TRAIN) + .orderNo(trainOrderInfo.getBasicInfo().getOrderID()) + .price(String.valueOf(trainOrderInfo.getOrderPaymentList().get(0).getFeeAmount())); + } + + // 处理租车订单 + List carOrderInfoList = itineraryEntity.getCarOrderInfoList(); + if (carOrderInfoList != null && carOrderInfoList.size() == 1) { + CarOrderInfoEntity carOrderInfo = carOrderInfoList.get(0); + return builder.productType(LEG_TYPE_TAXI) + .orderNo(String.valueOf(carOrderInfo.getBasicInfo().getOrderId())) + .price(String.valueOf(carOrderInfo.getPaymentInfoList().get(0).getAmount())); + } + + // 如果没有找到任何只含一个元素的列表,返回null + return null; + } +} diff --git a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java new file mode 100644 index 00000000..78d1089e --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java @@ -0,0 +1,13 @@ +package com.chint.domain.service.supplier; + +import com.chint.domain.value_object.OrderLegData; +import com.chint.domain.value_object.SupplierCallbackData; +import org.springframework.stereotype.Component; + +@Component +public class LYOrderDataAdapter implements OrderDataAdapter{ + @Override + public OrderLegData adapt(SupplierCallbackData supplierData) { + return null; + } +} diff --git a/src/main/java/com/chint/domain/service/supplier/OrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/OrderDataAdapter.java new file mode 100644 index 00000000..9dcf7ab2 --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/OrderDataAdapter.java @@ -0,0 +1,8 @@ +package com.chint.domain.service.supplier; + +import com.chint.domain.value_object.OrderLegData; +import com.chint.domain.value_object.SupplierCallbackData; + +public interface OrderDataAdapter { + OrderLegData adapt(SupplierCallbackData supplierData); +} diff --git a/src/main/java/com/chint/domain/service/supplier/OrderDataAdapterSelector.java b/src/main/java/com/chint/domain/service/supplier/OrderDataAdapterSelector.java new file mode 100644 index 00000000..a526fce7 --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/OrderDataAdapterSelector.java @@ -0,0 +1,26 @@ +package com.chint.domain.service.supplier; + +import com.chint.domain.exceptions.NotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.Constant.*; + +@Component +public class OrderDataAdapterSelector { + + @Autowired + private CTripOrderDataAdapter cTripOrderDataAdapter; + + @Autowired + private LYOrderDataAdapter lyOrderDataAdapter; + + public OrderDataAdapter of(String supplierName) { + // 当找不到匹配的适配器时,抛出一个异常 + return switch (supplierName) { + case SUPPLIER_C_TRIP -> cTripOrderDataAdapter; + case SUPPLIER_L_Y -> lyOrderDataAdapter; + default -> throw new NotFoundException(NOT_FOUND); + }; + } +} \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/supplier/SupplierService.java b/src/main/java/com/chint/domain/service/supplier/SupplierService.java new file mode 100644 index 00000000..2422df43 --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/SupplierService.java @@ -0,0 +1,7 @@ +package com.chint.domain.service.supplier; + +import com.chint.domain.value_object.SupplierCallbackData; + +public interface SupplierService { + void handleSupplierCallback(SupplierCallbackData callbackData); +} \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java b/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java new file mode 100644 index 00000000..c9a56f07 --- /dev/null +++ b/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java @@ -0,0 +1,23 @@ +package com.chint.domain.service.supplier; + +import com.chint.application.commands.RouteAddOrderCommand; +import com.chint.domain.value_object.OrderLegData; +import com.chint.domain.value_object.SupplierCallbackData; +import com.chint.infrastructure.echo_framework.command.Command; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SupplierServiceImpl implements SupplierService { + + @Autowired + private OrderDataAdapterSelector orderDataAdapterSelector; + + @Override + public void handleSupplierCallback(SupplierCallbackData callbackData) { + OrderLegData data = orderDataAdapterSelector + .of(callbackData.getSupplierName()) + .adapt(callbackData); + Command.of(RouteAddOrderCommand.class).data(data).sendToQueue(); + } +} diff --git a/src/main/java/com/chint/domain/value_object/OrderLegData.java b/src/main/java/com/chint/domain/value_object/OrderLegData.java index 21041f58..735cbd91 100644 --- a/src/main/java/com/chint/domain/value_object/OrderLegData.java +++ b/src/main/java/com/chint/domain/value_object/OrderLegData.java @@ -1,9 +1,69 @@ package com.chint.domain.value_object; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; +@AllArgsConstructor +@NoArgsConstructor @Data public class OrderLegData { + private String actualOrderNo; private String orderNo; - private String amount; + private String supplierName; + private Integer productType; + private String price; + + private OrderLegData(Builder builder) { + this.actualOrderNo = builder.actualOrderNo; + this.orderNo = builder.orderNo; + this.supplierName = builder.supplierName; + this.productType = builder.productType; + this.price = builder.price; + } + + public static Builder builder() { + return new Builder(); + } + + // Builder class + public static class Builder { + private String actualOrderNo; + private String orderNo; + private String supplierName; + private Integer productType; + private String price; + + public Builder() { + } + + public Builder actualOrderNo(String actualOrderNo) { + this.actualOrderNo = actualOrderNo; + return this; + } + + public Builder orderNo(String orderNo) { + this.orderNo = orderNo; + return this; + } + + public Builder supplierName(String supplierName) { + this.supplierName = supplierName; + return this; + } + + public Builder productType(Integer productType) { + this.productType = productType; + return this; + } + + public Builder price(String price) { + this.price = price; + return this; + } + + public OrderLegData build() { + return new OrderLegData(this); + } + } } diff --git a/src/main/java/com/chint/domain/value_object/RejectLegData.java b/src/main/java/com/chint/domain/value_object/RejectLegData.java new file mode 100644 index 00000000..31bb5af4 --- /dev/null +++ b/src/main/java/com/chint/domain/value_object/RejectLegData.java @@ -0,0 +1,10 @@ +package com.chint.domain.value_object; + +import lombok.Data; + +@Data +public class RejectLegData { +// private Long routeId; +// private String fakeOrderNo; + private String actualOrderNo; +} diff --git a/src/main/java/com/chint/domain/value_object/SupplierCallbackData.java b/src/main/java/com/chint/domain/value_object/SupplierCallbackData.java new file mode 100644 index 00000000..5ab905c2 --- /dev/null +++ b/src/main/java/com/chint/domain/value_object/SupplierCallbackData.java @@ -0,0 +1,21 @@ +package com.chint.domain.value_object; + +import lombok.Data; + +@Data +public class SupplierCallbackData { + private String supplierName; + private String employeeNo; + private Object data; + + public static SupplierCallbackData of(String supplierName) { + SupplierCallbackData supplierCallbackData = new SupplierCallbackData(); + supplierCallbackData.setSupplierName(supplierName); + return supplierCallbackData; + } + + public SupplierCallbackData data(Object data) { + this.data = data; + return this; + } +} diff --git a/src/main/java/com/chint/domain/value_object/UpdateLegData.java b/src/main/java/com/chint/domain/value_object/UpdateLegData.java new file mode 100644 index 00000000..ec9c8bc8 --- /dev/null +++ b/src/main/java/com/chint/domain/value_object/UpdateLegData.java @@ -0,0 +1,9 @@ +package com.chint.domain.value_object; + +import lombok.Data; + +@Data +public class UpdateLegData { + private Long LegId; + private Long orderDetailId; +} diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index dea0b347..e16b33ec 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -141,7 +141,8 @@ public class Constant { public static final String C_TRIP_CORP_ID = "zhengtai2024"; public static final String C_TRIP_APP_KEY = "obk_zhengtai2024"; // 测试appkey public static final String C_TRIP_APP_SECURITY = "fI3}FZX+zUdxPa2W!R6I2gYO"; // 测试app秘钥 - public static final String C_TRIP_H5_LOGIN = "/corpservice/authorize/getticket"; // 测试app秘钥 + public static final String C_TRIP_LOGIN_TICKET = "/corpservice/authorize/getticket"; // H5单点登录的ticket获取 + public static final String C_TRIP_ORDER_SEARCH_PATH = "/switchapi/Order/SearchOrder"; // 测试app秘钥 public static final String USER_SAVE_PATH = "/corpservice/CorpCustService/SaveCorpCustInfoList"; public static final String HOTEL_CITY_PATH = "/corpopenapi/HotelCity/GetCountryCityExtend"; public static final String HOTEL_COUNTRY_PATH = "/corpopenapi/HotelCity/GetCountry"; @@ -155,7 +156,6 @@ public class Constant { public static final String C_TRIP_APPROVAL_PATH = "/switchapi/approval.svc/rest/setapproval"; public static final String C_TRIP_ESTIMATE_PATH = "/bookingrelatedservice/bookingrelatedopenapi"; public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken"; - public static final String C_TRIP_ORDER_SEARCH_PATH = "/switchapi/Order/SearchOrder"; public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login"; @@ -163,11 +163,18 @@ public class Constant { //同程 - public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn"; - public static final String L_Y_TOKEN_PATH = "/openapi/api/OAuth/v2/GetAccessToken"; - public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync"; - public static final String L_Y_USER_PATH = "/openapi/api/Employee/SyncEmployeeInfo"; - public static final String L_Y_LOGIN_PATH = "/openapi/api/Employee/SSO"; + public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi"; + public static final String L_Y_TOKEN_PATH = "/api/OAuth/v2/GetAccessToken"; + public static final String L_Y_ORDER_PATH = "/api/TravelApplyOrder/ApplyOrderSync"; + public static final String L_Y_USER_PATH = "/api/Employee/SyncEmployeeInfo"; + public static final String L_Y_LOGIN_PATH = "/api/Employee/SSO"; + public static final String L_Y_FLIGHT_LIST_PATH = "/api/DomesticFlight/GetFlightOrderList"; + public static final String L_Y_FLIGHT_DETAIL_PATH = "/api/DomesticFlight/GetFlightOrderDetail"; + public static final String L_Y_TRAIN_LIST_PATH = "/api/Train/GetTrainOrderList"; + public static final String L_Y_TRAIN_DETAIL_PATH = "/api/Train/GetTrainOrderDetail"; + public static final String L_Y_HOTEL_LIST_PATH = "/api/Hotel/GetHotelOrderList"; + public static final String L_Y_HOTEL_DETAIL_PATH = "/api/Hotel/GetHotelOrderDetail"; + public static final String L_Y_APP_ID = "zhengtai"; public static final String L_Y_ACCOUNT = "4f9cb1080b564dd0a94aa95f7a19c8b5"; // 测试appkey public static final String L_Y_PASSWORD = "1fD3SutgzfS48qznYQiq"; // 测试app秘钥 public static final String L_Y_SECRET = "WOHzCMvHd823iHgH"; // 测试app秘钥 @@ -183,13 +190,10 @@ public class Constant { public static final Integer L_Y_TRAVEL_TYPE_ALL = 0; // 全部(因公因私) public static final Integer L_Y_TRAVEL_TYPE_PERSON = 1; // (因公) public static final Integer L_Y_TRAVEL_TYPE_NO_PERSON = 2; // (因私) - - public static final String L_Y_TRAIN_MAX_PRICE = "/openapi/api/Train/TrainHighPirceSearchByCityName";//火车票价格查询 - - public static final String L_Y_FLY_PRICE = "/openapi/api/DomesticFlight/CheckFlightOrderBookableStatus";//飞机表估算价格 - - public static final String L_Y_HOTEL_List = "/openapi/api/Hotel/GetHotelCityList"; //酒店城市列表 - public static final String L_Y_HOTEL_MIN_PRICE = "/openapi/api/Hotel/GetHotelMinPrice";//酒店估算价格 + public static final String L_Y_TRAIN_MAX_PRICE = "/api/Train/TrainHighPirceSearchByCityName";//火车票价格查询 + public static final String L_Y_FLY_PRICE = "/api/DomesticFlight/CheckFlightOrderBookableStatus";//飞机表估算价格 + public static final String L_Y_HOTEL_List = "/api/Hotel/GetHotelCityList"; //酒店城市列表 + public static final String L_Y_HOTEL_MIN_PRICE = "/api/Hotel/GetHotelMinPrice";//酒店估算价格 // status public static final int STATUS_DISABLED = 0; diff --git a/src/main/java/com/chint/infrastructure/handler/GlobalExceptionHandler.java b/src/main/java/com/chint/infrastructure/handler/GlobalExceptionHandler.java index 773e2544..5d318e75 100644 --- a/src/main/java/com/chint/infrastructure/handler/GlobalExceptionHandler.java +++ b/src/main/java/com/chint/infrastructure/handler/GlobalExceptionHandler.java @@ -4,6 +4,7 @@ package com.chint.infrastructure.handler; import com.chint.domain.exceptions.CommandException; import com.chint.domain.exceptions.LegEventException; import com.chint.domain.exceptions.NotFoundException; +import com.chint.domain.exceptions.OrderException; import com.chint.infrastructure.util.Result; import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; @@ -29,4 +30,9 @@ public class GlobalExceptionHandler { public Result handleCommandException(HttpServletRequest request, CommandException e) { return Result.error(e.getMessage()); } + + @ExceptionHandler(OrderException.class) + public Result handleOrderException(HttpServletRequest request, OrderException e) { + return Result.error(e.getMessage()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java new file mode 100644 index 00000000..7052f7d8 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java @@ -0,0 +1,21 @@ +package com.chint.infrastructure.repository; + +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.exceptions.NotFoundException; +import com.chint.domain.repository.OrderDetailRepository; +import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import static com.chint.infrastructure.constant.Constant.NOT_FOUND; + +@Repository +public class OrderDetailRepositoryImpl implements OrderDetailRepository { + @Autowired + private JdbcOrderDetailRepository orderDetailRepository; + + @Override + public OrderDetail findById(Long orderDetailId) { + return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND)); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index f3af53cb..457b9ae2 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -32,6 +32,11 @@ public class RouteRepositoryImpl implements RouteRepository { return jdbcRouteRepository.findByApproveOrderNo_FakeOrderNo(fakeOrderNo); } + @Override + public RouteOrder findByActualOrderNo(String actualOrderNo) { + return jdbcRouteRepository.findByApproveOrderNo_ActualOrderNo(actualOrderNo); + } + @Override public RouteOrder save(RouteOrder routeOrder) { return jdbcRouteRepository.save(routeOrder); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java new file mode 100644 index 00000000..3d858309 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -0,0 +1,9 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.order.OrderDetail; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcOrderDetailRepository extends CrudRepository { +} 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 a51df694..c567e51f 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -14,4 +14,6 @@ public interface JdbcRouteRepository extends CrudRepository { RouteOrder findByApproveOrderNo_FakeOrderNo(String approveOrderNo_fakeOrderNo); + RouteOrder findByApproveOrderNo_ActualOrderNo(String approveOrderNo_actualOrderNo); + } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java index 418e73b8..cc2a7043 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java @@ -2,6 +2,7 @@ package com.chint.interfaces.rest.ctrip; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest; +import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequestOut; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult; import com.chint.interfaces.rest.ctrip.dto.Authentication; import org.springframework.beans.factory.annotation.Autowired; @@ -21,9 +22,11 @@ public class CTripApprovalRequest { private PostRequest postRequest; public ApprovalResult approval(ApprovalRequest approvalRequest) { + ApprovalRequestOut approvalRequestOut = new ApprovalRequestOut(); + approvalRequestOut.setRequest(approvalRequest); String ticket = ticketRequest.loadTicket(); - approvalRequest.setStatus(0); + approvalRequest.setStatus(1); approvalRequest.setAuth(Authentication.of(C_TRIP_APP_KEY, ticket)); - return postRequest.post(approvalUrl, approvalRequest, ApprovalResult.class); + return postRequest.post(approvalUrl, approvalRequestOut, ApprovalResult.class); } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java index 761be83e..0d9340cd 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java @@ -49,7 +49,7 @@ public class CTripLoginRequest { //H5单点登录 private String singleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; - private String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_H5_LOGIN; + private String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_TICKET; private String IDPEntityID = C_TRIP_ENTITY_ID; private String corpId = C_TRIP_CORP_ID; @@ -59,16 +59,19 @@ public class CTripLoginRequest { } - public HttpResponse authLogin(CTripAuthLoginParam authLoginParam) { - - String ticket = ticketRequest.loadTicket(); - String token = tokenRequest.getToken(); - authLoginParam.setTicket(ticket); + public PCResponse authLogin() { + User currentUser = BaseContext.getCurrentUser(); + String employeeId = String.valueOf( + currentUser.getEmployeeNo() + ); + CTripAuthLoginParam authLoginParam = CTripAuthLoginParam.of(String.valueOf( + employeeId + )); + authLoginParam.setForCorp(0); + String ticket = loadLoginToken(); String appKey = C_TRIP_APP_KEY; String uid = StringUtils.isNotBlank(authLoginParam.getUID()) ? authLoginParam.getUID() : ""; - - String employeeId = StringUtils.isNotBlank(authLoginParam.getEmployeeID()) ? authLoginParam.getEmployeeID() : ""; String email = StringUtils.isNotBlank(authLoginParam.getEmail()) ? authLoginParam.getEmail() : ""; String ta = StringUtils.isNotBlank(authLoginParam.getTA()) ? authLoginParam.getTA() : ""; Integer forCorp = authLoginParam.getForCorp() == null ? authLoginParam.getForCorp() : 0; @@ -96,23 +99,25 @@ public class CTripLoginRequest { Digest.md5(appKey + uid + employeeId + email + ta + forCopStr + cost1 + cost2 + cost3 + mdAppSecurity); authLoginParam.setSignature(finallySign); -// Result post = postRequest.post(authLoginUrl, authLoginParam, Result.class); - -// HttpClient client = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(authLoginUrl); List entitys = new ArrayList<>(); entitys.add(new BasicNameValuePair("AppKey", appKey)); - entitys.add(new BasicNameValuePair("Token", token)); entitys.add(new BasicNameValuePair("Ticket", ticket)); entitys.add(new BasicNameValuePair("EmployeeID", employeeId)); entitys.add(new BasicNameValuePair("Signature", finallySign)); - entitys.add(new BasicNameValuePair("ForCorp", "0")); + entitys.add(new BasicNameValuePair("ForCorp", String.valueOf(authLoginParam.getForCorp()))); try { httpPost.setEntity(new UrlEncodedFormEntity(entitys)); HttpClient client = new DefaultHttpClient(); try { - return client.execute(httpPost); + HttpResponse execute = client.execute(httpPost); + String body = EntityUtils.toString(execute.getEntity(), "UTF-8"); + String url = getPCUrlFromHtml(body); + PCResponse pcResponse = new PCResponse(); + pcResponse.setRedirectUrl(url); + pcResponse.setSuccess(true); + return pcResponse; } catch (IOException e) { throw new RuntimeException(e); } @@ -121,12 +126,16 @@ public class CTripLoginRequest { } } + private String loadLoginToken() { + H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(), H5LoginToken.class); + return h5TokenResponse.getToken(); + } + public H5Response hSingleLogin() { CTripHSingleLoginParam hSingleLoginParam = new CTripHSingleLoginParam(); User currentUser = BaseContext.getCurrentUser(); - H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(), H5LoginToken.class); - String token = h5TokenResponse.getToken(); + String token = loadLoginToken(); String accessUserId = C_TRIP_APP_KEY; String employeeId = String.valueOf(currentUser.getEmployeeNo()); String corpPayType = StringUtils.isNotBlank(hSingleLoginParam.getCorpPayType()) ? @@ -242,4 +251,35 @@ public class CTripLoginRequest { throw new NotFoundException(NOT_FOUND); } } + + private static String getPCUrlFromHtml(String htmlContent) { + // 正则表达式匹配 action URL + Pattern actionPattern = Pattern.compile("action=\"(.*?)\""); + Matcher actionMatcher = actionPattern.matcher(htmlContent); + String actionUrl = ""; + if (actionMatcher.find()) { + actionUrl = actionMatcher.group(1); // 获取 action URL + } + + // 正则表达式匹配所有隐藏的 input 元素 + Pattern inputPattern = Pattern.compile(""); + Matcher inputMatcher = inputPattern.matcher(htmlContent); + + StringBuilder urlBuilder = new StringBuilder(actionUrl); + boolean isFirstParam = true; + + while (inputMatcher.find()) { + if (isFirstParam) { + urlBuilder.append("?"); // 第一个参数前添加 ? + isFirstParam = false; + } else { + urlBuilder.append("&"); // 后续参数前添加 & + } + urlBuilder.append(inputMatcher.group(1)) // 添加参数名 + .append("=") + .append(inputMatcher.group(2)); // 添加参数值 + } + + return urlBuilder.toString(); + } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java new file mode 100644 index 00000000..8b1f0a5f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java @@ -0,0 +1,33 @@ +package com.chint.interfaces.rest.ctrip; + +import com.chint.interfaces.rest.base.PostRequest; +import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderRequest; +import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import static com.chint.infrastructure.constant.Constant.*; + +@Service +public class CTripOrderSearchRequest { + private String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH; + + @Autowired + private PostRequest postRequest; + + @Autowired + private CTripTicketRequest ticketRequest; + + public SearchOrderResponse searchOrder(String journeyNo) { + String ticket = ticketRequest.loadTicket(); + SearchOrderRequest request = SearchOrderRequest + .builder() + .authInfo() + .details(C_TRIP_APP_KEY, ticket) + .done() + .language(LANGUAGE_CN) + .journeyNo(journeyNo) + .done(); + return postRequest.post(searchUrl, request, SearchOrderResponse.class); + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/Authentication.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/Authentication.java index e03351ba..a2a94c59 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/Authentication.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/Authentication.java @@ -6,8 +6,8 @@ import lombok.Data; @Data @AllArgsConstructor public class Authentication { - private String appKey; - private String ticket; + private String AppKey; + private String Ticket; // Getters and setters... public static Authentication of(String appKey, String ticket) { diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequest.java index 134b9e03..8305d09d 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequest.java @@ -18,108 +18,109 @@ import java.util.List; public class ApprovalRequest { // 审批单号 - 必填 // OA审批通过时生成,同步审批单编号,用于标识审批单 - private String approvalNumber; + private String ApprovalNumber; // 状态 - 必填 - // 0为审批中,1为审批通过,2为审批拒绝 - private int status; + // 1 + private int Status; // 携程卡号 - 非必填 // N表示非必填,多个携程卡号以逗号隔开,长度不能超过500个字符且不重复。 - private String ctripCardNO; + private String CtripCardNO; // 员工编号 - 非必填 // N表示非必填,多个员工编号以逗号隔开,长度不能超过500个字符且不重复。 - private String employeeID; + private String EmployeeID; // 机票背书信息详情列表 - 必填 // Y表示必填项,用于记录一条审批单中的一条或多条航班信息,详细信息格式见3.3.2节的JSON数据交互格式详细说明。 - private List flightEndorsementDetails; + private List FlightEndorsementDetails; // 酒店背书信息详情列表 - 必填 // Y表示必填项。 - private List hotelEndorsementDetails; + private List HotelEndorsementDetails; // 火车背书信息详情列表 - 必填 // Y表示必填项。 - private List trainEndorsementDetails; + private List TrainEndorsementDetails; // 租车背书信息详情列表 - 必填 // Y表示必填项。 - private List carQuickEndorsementDetails; + private List CarQuickEndorsementDetails; // 接送车背书信息详情列表 - 必填 // Y表示必填项。 - private List carPickUpEndorsementDetails; + private List CarPickUpEndorsementDetails; // 包车背书信息详情列表 - 必填 // Y表示必填项。 - private List carCharterEndorsementDetails; + private List CarCharterEndorsementDetails; // 巴士背书信息详情列表 - 必填 // Y表示必填项。 - private List busEndorsementDetails; + private List BusEndorsementDetails; // 出差计划背书信息详情列表 - 必填 // Y表示必填项。 - private List travelPlanEndorsementDetails; + private List TravelPlanEndorsementDetails; // 有效期 - 非必填 // 有效期格式为日期时间,起始时间从2017-01-01开始。 - private String expiredTime; + private String ExpiredTime; // 认证信息 - 非必填 // 携程分配给客户公司,具体见下表描述。 - private Authentication auth; + private Authentication Auth; // 成本中心等扩展字段列表,非必填,如无该需求则不需要传 - // Y表示必填项。 - private List extendFieldList; + // Y表示必填项。R + private List ExtendFieldList; // 备注 - 必填 // Y表示必填项。 - private String remark; + private String Remark; // 职级信息 - 非必填 // 职级信息(仅限于职级信息的前20) - private RankInfo rankInfo; + private RankInfo RankInfo; public ApprovalRequest(String approvalNumber, String employeeID, RankInfo rankInfo) { - this.approvalNumber = approvalNumber; - this.employeeID = employeeID; - this.rankInfo = rankInfo; + this.ApprovalNumber = approvalNumber; + this.EmployeeID = employeeID; + this.RankInfo = rankInfo; } - public static ApprovalRequest buildApproval(String employeeID, String approvalNumber, RankInfo rankInfo) { - return new ApprovalRequest(employeeID, approvalNumber, rankInfo); + public static ApprovalRequest buildApproval(String approvalNumber, String employeeID, RankInfo rankInfo) { + return new ApprovalRequest(approvalNumber,employeeID, rankInfo); } public ApprovalRequest withAir(List flightEndorsementDetails) { - this.flightEndorsementDetails = flightEndorsementDetails; + this.FlightEndorsementDetails = flightEndorsementDetails; return this; } - public ApprovalRequest withTrain(List hotelEndorsementDetails) { - this.hotelEndorsementDetails = hotelEndorsementDetails; + public ApprovalRequest withTrain(List trainEndorsementDetails) { + this.TrainEndorsementDetails = trainEndorsementDetails; return this; } public ApprovalRequest withBus(List busEndorsementDetails) { - this.busEndorsementDetails = busEndorsementDetails; + this.BusEndorsementDetails = busEndorsementDetails; return this; } public ApprovalRequest withPickCar(List carPickUpEndorsementDetails) { - this.carPickUpEndorsementDetails = carPickUpEndorsementDetails; + this.CarPickUpEndorsementDetails = carPickUpEndorsementDetails; return this; } public ApprovalRequest withQuickCar(List carQuickEndorsementDetails) { - this.carQuickEndorsementDetails = carQuickEndorsementDetails; + this.CarQuickEndorsementDetails = carQuickEndorsementDetails; return this; } + public ApprovalRequest withHotel(List hotelEndorsementDetails) { - this.hotelEndorsementDetails = hotelEndorsementDetails; + this.HotelEndorsementDetails = hotelEndorsementDetails; return this; } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequestOut.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequestOut.java new file mode 100644 index 00000000..4aeba38e --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalRequestOut.java @@ -0,0 +1,8 @@ +package com.chint.interfaces.rest.ctrip.dto.approval; + +import lombok.Data; + +@Data +public class ApprovalRequestOut { + private ApprovalRequest request; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResponse.java new file mode 100644 index 00000000..94335be6 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResponse.java @@ -0,0 +1,8 @@ +package com.chint.interfaces.rest.ctrip.dto.approval; + +import lombok.Data; + +@Data +public class ApprovalResponse { + private ResponseStatus Status; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResult.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResult.java index 84d55944..3ddfe988 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResult.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/ApprovalResult.java @@ -5,6 +5,8 @@ import lombok.Data; @Data public class ApprovalResult { - private ResponseStatus Status; + private ApprovalResponse SetApprovalResult; + + } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/air/FlightEndorsementDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/air/FlightEndorsementDetail.java index 3c81f3d8..c4bee544 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/air/FlightEndorsementDetail.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/air/FlightEndorsementDetail.java @@ -1,100 +1,131 @@ package com.chint.interfaces.rest.ctrip.dto.approval.air; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType; import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail; +import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail; import lombok.Data; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; @Data public class FlightEndorsementDetail { // 订票类型列表 - 1张, 2张, 3张, 超过3张 - private List bookingTypeList; + private List BookingTypeList; // 订单ID列表 - 最多20个 - private List orderIDList; + private List OrderIDList; // 航空公司名称 - 不可为空字符串 - private String airline; + private String Airline; // 货币类型 - 默认CNY - private CurrencyType currency; + private CurrencyType Currency; // 航班类型 - 单程(1) or 往返(2) - private FlightWayType flightWay; + private FlightWayType FlightWay; // 起飞日期开始时间 - 格式: yyyy-MM-dd - private String departDateBegin; + private String DepartDateBegin; // 起飞日期结束时间 - 格式: yyyy-MM-dd - private String departDateEnd; + private String DepartDateEnd; // 返回日期开始时间 - 格式: yyyy-MM-dd - private String returnDateBegin; + private String ReturnDateBegin; // 返回日期结束时间 - 格式: yyyy-MM-dd - private String returnDateEnd; + private String ReturnDateEnd; // 起飞时间开始时间 - 格式: HH:mm - private String takeOffBeginTime; + private String TakeOffBeginTime; // 起飞时间结束时间 - 格式: HH:mm - private String takeOffEndTime; + private String TakeOffEndTime; // 到达时间开始时间 - 格式: HH:mm - private String arrivalBeginTime; + private String ArrivalBeginTime; // 到达时间结束时间 - 格式: HH:mm - private String arrivalEndTime; + private String ArrivalEndTime; // 折扣率 - 0.1到1.0, 0代表无折扣 - private float discount; + private float Discount; // 出发国家ID列表 - 最多1000个 - private List departCountryIds; + private List DepartCountryIds; // 出发国家代码列表 - 最多1000个 - private List departCountryCodes; + private List DepartCountryCodes; // 出发城市代码列表 - 最多1000个 - private List departCityCodes; + private List DepartCityCodes; // 到达国家ID列表 - 最多1000个 - private List arrivalCountryIds; + private List ArrivalCountryIds; // 到达城市代码列表 - 最多1000个 - private List arrivalCityCodes; + private List ArrivalCityCodes; // 出发城市ID列表 - 最多1000个 - private List departCityIds; + private List DepartCityIds; // 到达城市ID列表 - 最多1000个 - private List arrivalCityIds; + private List ArrivalCityIds; // 乘客列表 - 无数量限制 - private List passengerList; + private List PassengerList; // 价格 - 可为负数, 默认为0 - private float price; + private float Price; // 产品类型 - 1代表经济舱, 2代表商务舱 - private ProductTypeEnum productType; + private ProductTypeEnum ProductType; // 座位等级 - 经济舱(3), 商务舱(2), 头等舱(1) - private SeatClassType seatClass; + private SeatClassType SeatClass; // 跳过的字段位 - 用于标记不包含的字段 - private long skipFields; + private long SkipFields; // 旅客数量 - 无限制 - private int travelerCount; + private int TravelerCount; // 总旅客数量 - 用于统计 - private int totalTravelerCount; + private int TotalTravelerCount; // 预验证字段位 - 用于标记需要预验证的字段 - private long preVerifyFields; + private long PreVerifyFields; // Getters and setters... + + public static FlightEndorsementDetail of(List DepartCityIds , List ArrivalCityIds) { + FlightEndorsementDetail flightEndorsementDetail = new FlightEndorsementDetail(); + flightEndorsementDetail.setDepartCountryIds(DepartCityIds); + flightEndorsementDetail.setArrivalCityIds(ArrivalCityIds); + return flightEndorsementDetail; + } + + public FlightEndorsementDetail passenger(PassengerDetail passengerDetail) { + if (this.PassengerList == null) { + this.PassengerList = new ArrayList<>(); + } + this.PassengerList.add(passengerDetail); + return this; + } + + public FlightEndorsementDetail starTime(LocalDateTime startTime) { + this.DepartDateBegin = DateTimeUtil.timeToStr(startTime); + this.ReturnDateBegin = DateTimeUtil.timeToStr(startTime); + return this; + } + + public FlightEndorsementDetail endTime(LocalDateTime endTime) { + this.DepartDateEnd = DateTimeUtil.timeToStr(endTime); + this.ReturnDateEnd = DateTimeUtil.timeToStr(endTime); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/hotel/HotelEndorsementDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/hotel/HotelEndorsementDetail.java index 68387183..ac8edbd8 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/hotel/HotelEndorsementDetail.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/hotel/HotelEndorsementDetail.java @@ -14,64 +14,64 @@ import java.util.List; public class HotelEndorsementDetail { // 产品类型 - private HotelProductTypeEnum productType; + private HotelProductTypeEnum ProductType; // 入住开始日期 - 格式: yyyy-MM-dd - private String checkInDateBegin; + private String CheckInDateBegin; // 入住结束日期 - 格式: yyyy-MM-dd - private String checkInDateEnd; + private String CheckInDateEnd; // 离店开始日期 - 格式: yyyy-MM-dd - private String checkOutDateBegin; + private String CheckOutDateBegin; // 离店结束日期 - 格式: yyyy-MM-dd - private String checkOutDateEnd; + private String CheckOutDateEnd; // 乘客列表 - private List passengerList; + private List PassengerList; // 入住国家ID列表 - private List checkInCountryIds; + private List CheckInCountryIds; // 入住国家代码列表 - private List checkInCountryCodes; + private List CheckInCountryCodes; // 入住城市代码列表 - private List checkInCityCodes; + private List CheckInCityCodes; // 最高价格 - private String maxPrice; + private String MaxPrice; // 最低价格 - private String minPrice; + private String MinPrice; // 货币类型 - 默认CNY - private CurrencyType currency; + private CurrencyType Currency; // 最大星级 - private String maxStarRating; + private String MaxStarRating; // 最小星级 - private String minStarRating; + private String MinStarRating; // 平均价格 - private String averagePrice; + private String AveragePrice; // 房间数量 - private int roomCount; + private int RoomCount; // 跳过的字段位 - 用于标记不包含的字段 - private long skipFields; + private long SkipFields; // 总房晚数 - private int totalRoomNightCount; + private int TotalRoomNightCount; // 房晚价格 - private String roomNightPrice; + private String RoomNightPrice; // 预验证字段位 - 用于标记需要预验证的字段 - private long preVerifyFields; + private long PreVerifyFields; // Getters and setters... @@ -82,22 +82,22 @@ public class HotelEndorsementDetail { } public HotelEndorsementDetail passenger(PassengerDetail passengerDetail) { - if (this.passengerList == null) { - this.passengerList = new ArrayList<>(); + if (this.PassengerList == null) { + this.PassengerList = new ArrayList<>(); } - this.passengerList.add(passengerDetail); + this.PassengerList.add(passengerDetail); return this; } public HotelEndorsementDetail starTime(LocalDateTime startTime) { - this.checkInDateBegin = DateTimeUtil.timeToStr(startTime); - this.checkOutDateBegin = DateTimeUtil.timeToStr(startTime); + this.CheckInDateBegin = DateTimeUtil.timeToStr(startTime); + this.CheckOutDateBegin = DateTimeUtil.timeToStr(startTime); return this; } public HotelEndorsementDetail endTime(LocalDateTime endTime) { - this.checkInDateEnd = DateTimeUtil.timeToStr(endTime); - this.checkOutDateEnd = DateTimeUtil.timeToStr(endTime); + this.CheckInDateEnd = DateTimeUtil.timeToStr(endTime); + this.CheckOutDateEnd = DateTimeUtil.timeToStr(endTime); return this; } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/quick/CarQuickEndorsementDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/quick/CarQuickEndorsementDetail.java index c3334897..d2bb0c00 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/quick/CarQuickEndorsementDetail.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/quick/CarQuickEndorsementDetail.java @@ -1,42 +1,70 @@ package com.chint.interfaces.rest.ctrip.dto.approval.quick; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType; import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail; +import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail; import lombok.Data; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; @Data public class CarQuickEndorsementDetail { // 产品类型 - private int productType; + private int ProductType; // 乘客列表, 最多100名 - private List passengerList; + private List PassengerList; // 城市代码 - private String cities; + private String Cities; // 公司地址列表 - private List companyAddressList; + private List CompanyAddressList; // 到达地址列表 - private List arrivalAddressList; + private List ArrivalAddressList; // 开始使用日期 - private String beginUseDate; + private String BeginUseDate; // 结束使用日期 - private String endUseDate; + private String EndUseDate; // 使用时间列表 - private List useTimeList; + private List UseTimeList; // 货币类型, 默认CNY - private CurrencyType currency; + private CurrencyType Currency; // 价格,默认为0 - private float price; + private float Price; // 车辆组 - private String vehicleGroup; + private String VehicleGroup; // 有效性金额 - private int effectivenessAmount; + private int EffectivenessAmount; // 跳过的字段位 - private long skipFields; + private long SkipFields; // 到达城市代码 - private String arrivalCities; + private String ArrivalCities; // Getters and setters... + + public static CarQuickEndorsementDetail of(List cities) { + CarQuickEndorsementDetail carQuickEndorsementDetail = new CarQuickEndorsementDetail(); + carQuickEndorsementDetail.setArrivalCities(String.join(",",cities)); + return carQuickEndorsementDetail; + } + + public CarQuickEndorsementDetail passenger(PassengerDetail passengerDetail) { + if (this.PassengerList == null) { + this.PassengerList = new ArrayList<>(); + } + this.PassengerList.add(passengerDetail); + return this; + } + + public CarQuickEndorsementDetail starTime(LocalDateTime startTime) { + this.BeginUseDate = DateTimeUtil.timeToStr(startTime); + return this; + } + + public CarQuickEndorsementDetail endTime(LocalDateTime endTime) { + this.EndUseDate = DateTimeUtil.timeToStr(endTime); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/train/TrainEndorsementDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/train/TrainEndorsementDetail.java index e4d9236a..02b76224 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/train/TrainEndorsementDetail.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/approval/train/TrainEndorsementDetail.java @@ -1,69 +1,103 @@ package com.chint.interfaces.rest.ctrip.dto.approval.train; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType; import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail; +import com.chint.interfaces.rest.ctrip.dto.approval.air.FlightEndorsementDetail; +import lombok.Data; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; // TrainEndorsementDetail class definition + +@Data public class TrainEndorsementDetail { // 火车产品类型 - private TrainProductTypeEnum productType; + private TrainProductTypeEnum ProductType; // 订票类型列表 - 1张, 2张, 3张, 超过3张 - private List bookingTypeList; + private List BookingTypeList; // 订单ID列表 - private List orderIDList; + private List OrderIDList; // 行程类型 - 单程(1) or 往返(2) - private TripTypeEnum tripType; + private TripTypeEnum TripType; // 出发日期开始 - 格式: yyyy-MM-dd - private String departDateBegin; + private String DepartDateBegin; // 出发日期结束 - 格式: yyyy-MM-dd - private String departDateEnd; + private String DepartDateEnd; // 返回日期开始 - 格式: yyyy-MM-dd - private String returnDateBegin; + private String ReturnDateBegin; // 返回日期结束 - 格式: yyyy-MM-dd - private String returnDateEnd; + private String ReturnDateEnd; // 乘客列表 - 无限制 - private List passengerList; + private List PassengerList; // 到达城市代码列表 - 最多1000个 - private List arrivalCityCodes; + private List ArrivalCityCodes; // 出发城市代码列表 - 最多1000个 - private List departCityCodes; + private List DepartCityCodes; // 价格 - 可为负数, 默认为0 - private String price; + private String Price; // 货币类型 - 默认CNY - private CurrencyType currency; + private CurrencyType Currency; // 座位类型 - private List seatType; + private List SeatType; // 跳过的字段位 - 用于标记不包含的字段 - private long skipFields; + private long SkipFields; // 旅客数量 - 默认为0 - private int travelerCount; + private int TravelerCount; // 预验证字段位 - 用于标记需要预验证的字段 - private long preVerifyFields; + private long PreVerifyFields; // 列车车次列表 - 如G, D, C, Z, T, K等 - private List trainVehicleTypeList; + private List TrainVehicleTypeList; // 总旅客数量 - 用于统计 - private int totalTravelerCount; + private int TotalTravelerCount; // Getters and setters... + + public static TrainEndorsementDetail of(List DepartCityCodes , List ArrivalCityCodes) { + TrainEndorsementDetail trainEndorsementDetail = new TrainEndorsementDetail(); + trainEndorsementDetail.setDepartCityCodes(DepartCityCodes); + trainEndorsementDetail.setArrivalCityCodes(ArrivalCityCodes); + return trainEndorsementDetail; + } + + public TrainEndorsementDetail passenger(PassengerDetail passengerDetail) { + if (this.PassengerList == null) { + this.PassengerList = new ArrayList<>(); + } + this.PassengerList.add(passengerDetail); + return this; + } + + public TrainEndorsementDetail starTime(LocalDateTime startTime) { + this.DepartDateBegin = DateTimeUtil.timeToStr(startTime); + this.ReturnDateBegin = DateTimeUtil.timeToStr(startTime); + return this; + } + + public TrainEndorsementDetail endTime(LocalDateTime endTime) { + this.DepartDateEnd = DateTimeUtil.timeToStr(endTime); + this.ReturnDateEnd = DateTimeUtil.timeToStr(endTime); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/CTripAuthLoginParam.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/CTripAuthLoginParam.java index a8727baa..a1e75bef 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/CTripAuthLoginParam.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/CTripAuthLoginParam.java @@ -32,5 +32,10 @@ public class CTripAuthLoginParam { private String OrderId; private Boolean OnlyInitPage; + public static CTripAuthLoginParam of(String employeeID) { + CTripAuthLoginParam cTripAuthLoginParam = new CTripAuthLoginParam(); + cTripAuthLoginParam.setEmployeeID(employeeID); + return cTripAuthLoginParam; + } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/PCResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/PCResponse.java new file mode 100644 index 00000000..e1f4d8a3 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/PCResponse.java @@ -0,0 +1,10 @@ +package com.chint.interfaces.rest.ctrip.dto.login; + + +import lombok.Data; + +@Data +public class PCResponse { + private String redirectUrl; + private boolean success; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/TrainTicketChangeNotification.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/TrainTicketChangeNotification.java index 9b7ec58f..f718c4e5 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/TrainTicketChangeNotification.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/TrainTicketChangeNotification.java @@ -1,8 +1,11 @@ package com.chint.interfaces.rest.ctrip.dto.put; +import lombok.Data; + import java.util.List; +@Data public class TrainTicketChangeNotification { private String businessId; private String businessType; @@ -19,110 +22,4 @@ public class TrainTicketChangeNotification { private List passengerInfoList; private String uId; - - // Getter and Setter methods for all fields - - public String getBusinessId() { - return businessId; - } - - public void setBusinessId(String businessId) { - this.businessId = businessId; - } - - public String getBusinessType() { - return businessType; - } - - public void setBusinessType(String businessType) { - this.businessType = businessType; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getContentEn() { - return contentEn; - } - - public void setContentEn(String contentEn) { - this.contentEn = contentEn; - } - - public String getCorpId() { - return corpId; - } - - public void setCorpId(String corpId) { - this.corpId = corpId; - } - - public String getMessageCategory() { - return messageCategory; - } - - public void setMessageCategory(String messageCategory) { - this.messageCategory = messageCategory; - } - - public String getMessageType() { - return messageType; - } - - public void setMessageType(String messageType) { - this.messageType = messageType; - } - - public String getPreEmployeeID() { - return preEmployeeID; - } - - public void setPreEmployeeID(String preEmployeeID) { - this.preEmployeeID = preEmployeeID; - } - - public String getSign() { - return sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getTitleEn() { - return titleEn; - } - - public void setTitleEn(String titleEn) { - this.titleEn = titleEn; - } - - public String getTitleImageUrl() { - return titleImageUrl; - } - - public void setTitleImageUrl(String titleImageUrl) { - this.titleImageUrl = titleImageUrl; - } - - public String getuId() { - return uId; - } - - public void setuId(String uId) { - this.uId = uId; - } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/CarOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/CarOrderInfoEntity.java deleted file mode 100644 index cd06a3de..00000000 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/CarOrderInfoEntity.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.chint.interfaces.rest.ctrip.dto.search; - -public class CarOrderInfoEntity { -} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/FlightOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/FlightOrderInfoEntity.java deleted file mode 100644 index 94169f44..00000000 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/FlightOrderInfoEntity.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.chint.interfaces.rest.ctrip.dto.search; - -public class FlightOrderInfoEntity { -} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/HotelOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/HotelOrderInfoEntity.java deleted file mode 100644 index 65c01773..00000000 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/HotelOrderInfoEntity.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.chint.interfaces.rest.ctrip.dto.search; - -import lombok.Data; - -@Data -public class HotelOrderInfoEntity { -} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/ItineraryEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/ItineraryEntity.java index 1abb9ec0..a199d67f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/ItineraryEntity.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/ItineraryEntity.java @@ -1,5 +1,9 @@ package com.chint.interfaces.rest.ctrip.dto.search; +import com.chint.interfaces.rest.ctrip.dto.search.car.CarOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity; +import com.chint.interfaces.rest.ctrip.dto.search.train.TrainOrderInfoEntity; import lombok.Data; import java.util.List; @@ -8,23 +12,21 @@ import java.util.List; public class ItineraryEntity { // 行程单号 - private String journeyNO; // 行程单号 + private String JourneyNO; // 行程单号 // 酒店订单信息列表 - private List hotelOrderInfoList; // 酒店订单信息列表 + private List HotelOrderInfoList; // 酒店订单信息列表 // 航班订单信息列表 - private List flightOrderInfoList; // 航班订单信息列表 + private List FlightOrderInfoList; // 航班订单信息列表 // 火车票订单信息列表 - private List trainOrderInfoList; // 火车票订单信息列表 + private List TrainOrderInfoList; // 火车票订单信息列表 // 租车订单信息列表 - private List carOrderInfoList; // 租车订单信息列表 + private List CarOrderInfoList; // 租车订单信息列表 // 快捷租车订单信息列表 - private List carQuickOrderInfoList; // 快捷租车订单信息列表 + private List CarQuickOrderInfoList; // 快捷租车订单信息列表 // 接送机租车订单信息列表 - private List domPickUpCarOrderInfoList; // 接送机租车订单信息列表 + private List DomPickUpCarOrderInfoList; // 接送机租车订单信息列表 // 包车租车订单信息列表 - private List domCharterCarOrderInfoList; // 包车租车订单信息列表 + private List DomCharterCarOrderInfoList; // 包车租车订单信息列表 // 国际火车票订单信息列表 - private List intlTrainOrderInfoList; // 国际火车票订单信息列表 - - // Getters and Setters... + private List IntlTrainOrderInfoList; // 国际火车票订单信息列表 } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderRequest.java index 5de078d3..e152b209 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderRequest.java @@ -34,5 +34,9 @@ public class SearchOrderRequest { private String htlSearchTypeExtend; // 酒店查询类型扩展 private String carSearchTypeExtend; // 租车查询类型扩展 + public static SearchRequestBuilder builder() { + return new SearchRequestBuilder(); + } + // Getters and Setters... } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderResponse.java index 65a6c07b..45902c9b 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchOrderResponse.java @@ -9,9 +9,9 @@ import java.util.List; public class SearchOrderResponse { // 响应状态 - private ResponseStatus status; // 响应状态 + private ResponseStatus Status; // 响应状态 // 行程单列表 - private List itineraryList; // 行程单列表 + private List ItineraryList; // 行程单列表 // Getters and Setters... } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchRequestBuilder.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchRequestBuilder.java new file mode 100644 index 00000000..76526164 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/SearchRequestBuilder.java @@ -0,0 +1,46 @@ +package com.chint.interfaces.rest.ctrip.dto.search; + +import com.chint.interfaces.rest.ctrip.dto.Authentication; + +public class SearchRequestBuilder { + + private SearchOrderRequest request = new SearchOrderRequest(); + + public SearchRequestBuilder language(String language){ + request.setLanguage(language); + return this; + } + + public SearchRequestBuilder journeyNo(String journeyNo){ + request.setJourneyNo(journeyNo); + return this; + } + + public SearchOrderRequest done() { + return request; + } + + public AuthInfoBuilder authInfo() { + return new AuthInfoBuilder(this, request); + } + + public static class AuthInfoBuilder { + private final SearchRequestBuilder parentBuilder; + private final SearchOrderRequest request; + + public AuthInfoBuilder(SearchRequestBuilder parentBuilder, SearchOrderRequest request) { + this.parentBuilder = parentBuilder; + this.request = request; + } + + public AuthInfoBuilder details(String appKey, String accessToken) { + Authentication authInfo = new Authentication(appKey, accessToken); // Construct AuthInfo with parameters + request.setAuth(authInfo); + return this; + } + + public SearchRequestBuilder done() { + return parentBuilder; + } + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/TrainOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/TrainOrderInfoEntity.java deleted file mode 100644 index ff8cdfee..00000000 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/TrainOrderInfoEntity.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.chint.interfaces.rest.ctrip.dto.search; - -public class TrainOrderInfoEntity { -} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/BasicInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/BasicInfo.java new file mode 100644 index 00000000..252b0533 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/BasicInfo.java @@ -0,0 +1,19 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单基本信息类 +@Data +public class BasicInfo { + private long orderId; // 订单ID + private double estimateAmount; // 预估金额 + private double orderAmount; // 订单金额 + private double dealAmount; // 成交金额 + private String orderStatus; // 订单状态 + private String authorizeStatus; // 授权状态 + private String paymentStatus; // 支付状态 + private String paymentType; // 支付类型 + private String feeType; // 费用类型 + private String UID; // 用户ID + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/CarOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/CarOrderInfoEntity.java new file mode 100644 index 00000000..83a7d423 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/CarOrderInfoEntity.java @@ -0,0 +1,21 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +import java.util.List; + +@Data +public class CarOrderInfoEntity { + private BasicInfo basicInfo; // 基本信息 + private OrderProduct orderProduct; // 订单产品 + private List orderFeeList; // 订单费用列表 + private OrderInsurance orderInsurance; // 订单保险信息 + private OrderInvoice orderInvoice; // 订单发票信息 + private PassengerInfo passengerInfo; // 乘客信息 + private List paymentInfoList; // 支付信息列表 + private List paymentSettlementList; // 支付结算列表 + private List choosedVehicleList; // 选择的车辆列表 + private OrderConfigInfo orderConfigInfo; // 订单配置信息 + private List paymentSupplyList; // 支付供应列表 + private OrderPaymentInfo orderPaymentInfo; // 订单支付信息 +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/ChoosedVehicle.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/ChoosedVehicle.java new file mode 100644 index 00000000..d41bc7d7 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/ChoosedVehicle.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 选择的车辆信息类 +@Data +class ChoosedVehicle { + private double estimateAmount; // 预估金额 + private int vehicleId; // 车辆ID + private String vehicleName; // 车辆名称 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/DepartAddress.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/DepartAddress.java new file mode 100644 index 00000000..d31b06b5 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/DepartAddress.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 出发地址信息类 +@Data +class DepartAddress { + private String address; // 地址 + private String addressDetail; // 地址详情 + private String cityId; // 城市ID + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderConfigInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderConfigInfo.java new file mode 100644 index 00000000..b44e854f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderConfigInfo.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单配置信息类 +@Data +class OrderConfigInfo { + private String sceneName; // 场景名称 + private String standardName; // 标准名称 + private String carTravelSendType; // 汽车出行发送类型 + private String currency; // 货币类型 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderFee.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderFee.java new file mode 100644 index 00000000..c6b09c7d --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderFee.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单费用信息类 +@Data +class OrderFee { + private String costScene; // 费用场景 + private String feeTypeCode; // 费用类型编码 + private String feeName; // 费用名称 + private double amount; // 金额 + private String orderFeeId; // 订单费用ID + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInsurance.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInsurance.java new file mode 100644 index 00000000..ffb7eee8 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInsurance.java @@ -0,0 +1,11 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单保险信息类 +@Data +class OrderInsurance { + private String productCode; // 产品编码 + private String companyId; // 公司ID + // Other fields and getters/setters +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInvoice.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInvoice.java new file mode 100644 index 00000000..7bd4bec8 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderInvoice.java @@ -0,0 +1,11 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单发票信息类 +@Data +class OrderInvoice { + private String invoiceId; // 发票ID + private String customerTaxNumber; // 客户税号 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderPaymentInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderPaymentInfo.java new file mode 100644 index 00000000..d5922511 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderPaymentInfo.java @@ -0,0 +1,7 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +@Data +public class OrderPaymentInfo { +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderProduct.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderProduct.java new file mode 100644 index 00000000..ee2070de --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/OrderProduct.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 订单产品信息类 +@Data +public class OrderProduct { + private String vendorOrderId; // 供应商订单ID + private int bookingType; // 预订类型 + private String useTime; // 使用时间 + private DepartAddress departAddress; // 出发地址信息 + private PassengerPosition passengerPosition; // 乘客位置信息 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerInfo.java new file mode 100644 index 00000000..22502e6c --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerInfo.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 乘客信息类 +@Data +class PassengerInfo { + private String corpUserId; // 公司用户ID + private String employeeId; // 员工ID + private String intlCode; // 国际代码 + private String passengerId; // 乘客ID + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerPosition.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerPosition.java new file mode 100644 index 00000000..f4fb0525 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PassengerPosition.java @@ -0,0 +1,11 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 乘客位置信息类 +@Data +class PassengerPosition { + private String latitude; // 纬度 + private String longitude; // 经度 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentInfo.java new file mode 100644 index 00000000..424ea724 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentInfo.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 支付信息类 +@Data +public class PaymentInfo { + private double amount; // 金额 + private String billNo; // 账单号 + private String paidTime; // 支付时间 + private String paymentCategory; // 支付类别 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSettlement.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSettlement.java new file mode 100644 index 00000000..7ca61d31 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSettlement.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 支付结算信息类 +@Data +class PaymentSettlement { + private double amount; // 金额 + private String feeTypeCode; // 费用类型编码 + private String feeTypeName; // 费用类型名称 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSupply.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSupply.java new file mode 100644 index 00000000..162a156f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/car/PaymentSupply.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.car; + +import lombok.Data; + +// 支付供应信息类 +@Data +class PaymentSupply { + private String paymentSupplyId; // 支付供应ID + private long orderID; // 订单ID + private double serviceAmount; // 服务金额 + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/BasicInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/BasicInfo.java new file mode 100644 index 00000000..4dfa9786 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/BasicInfo.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +@Data +public class BasicInfo { + private String orderID; + private String tripID; + private String orderStatus; + private String orderStatusCode; + private String UID; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/DeliveryInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/DeliveryInfo.java new file mode 100644 index 00000000..6cb6c6fb --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/DeliveryInfo.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + +import lombok.Data; + +@Data +class DeliveryInfo { + private String deliveryInfo; + private String contactPhone; + private String contactMobile; + private String contactName; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightInfo.java new file mode 100644 index 00000000..0354a887 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightInfo.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +@Data +public class FlightInfo { + private String sequence; + private String flight; + private String airLineCode; + private String airLineName; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderFeeDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderFeeDetail.java new file mode 100644 index 00000000..5f392666 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderFeeDetail.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + +import lombok.Data; + +@Data +public class FlightOrderFeeDetail { + private String transactionType; + private String payType; + private int transactionAmount; + private String payCurrency; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderInfoEntity.java new file mode 100644 index 00000000..606c5be3 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/FlightOrderInfoEntity.java @@ -0,0 +1,15 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +import java.util.List; + +@Data +public class FlightOrderInfoEntity { + private BasicInfo basicInfo; + private DeliveryInfo deliveryInfo; + private List flightInfo; + private List passengerInfo; + private List flightOrderFeeDetailList; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerBasic.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerBasic.java new file mode 100644 index 00000000..6f99b45f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerBasic.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + +import lombok.Data; + +@Data +class PassengerBasic { + private String corpEid; + private String passengerName; + private String passengerNamePY; + private String nationalityCode; + private String cardTypeName; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerInfo.java new file mode 100644 index 00000000..5160d5a1 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/PassengerInfo.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +import java.util.List; + +@Data +public class PassengerInfo { + private PassengerBasic passengerBasic; + private List sequenceInfo; + + // Getters and setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/SequenceInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/SequenceInfo.java new file mode 100644 index 00000000..15f15a53 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/SequenceInfo.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +import java.util.List; + +@Data +class SequenceInfo { + private int sequence; + private List ticketInfo; + + // Getters and setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/TicketInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/TicketInfo.java new file mode 100644 index 00000000..7a87ddd9 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/flight/TicketInfo.java @@ -0,0 +1,13 @@ +package com.chint.interfaces.rest.ctrip.dto.search.flight; + + +import lombok.Data; + +@Data +class TicketInfo { + private String airLineCode; + private String ticketNo; + private String ticketNoSignCode; + private String status; + // Other fields and getters/setters +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/ClientInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/ClientInfo.java new file mode 100644 index 00000000..01149c5f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/ClientInfo.java @@ -0,0 +1,29 @@ +package com.chint.interfaces.rest.ctrip.dto.search.hotel; + +import lombok.Data; + +@Data +public class ClientInfo { + private int RoomIndex; // 房间索引 + private String ClientName; // 客户名 + private String EmployeeID; // 员工ID + private String CostCenter1; // 成本中心1 + private String CostCenter2; // 成本中心2 + private String CostCenter3; // 成本中心3 + private String CostCenter4; // 成本中心4 + private String CostCenter5; // 成本中心5 + private String CostCenter6; // 成本中心6 + private String Dept1; // 部门1 + private String Dept2; // 部门2 + private String Dept3; // 部门3 + private String Dept4; // 部门4 + // Dept5至Dept10可以根据实际需要添加 + private String CheckinTime; // 入住时间 + private String CheckoutTime; // 离店时间 + private String ActualDepartureTime; // 实际离开时间 + private double ShareOrderAmount; // 分摊订单金额 + // ClientPreApprovalNo字段的具体类型根据需要确定,如果是一个复杂结构,可能需要定义一个新的类 + private double Price; // 价格 + private String Star; // 星级 + private double ActualUpperAmount; // 实际上限金额 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java new file mode 100644 index 00000000..7bc94515 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java @@ -0,0 +1,71 @@ +package com.chint.interfaces.rest.ctrip.dto.search.hotel; + +import lombok.Data; + +import java.util.List; + +@Data +public class HotelOrderInfoEntity { + private String OrderId; // 订单ID + private String TripId; // 旅行ID + private String Uid; // 用户ID + private String PreEmployeeId; // 预订员工ID + private String PreEmployeeName; // 预订员工姓名 + private String Currency; // 货币类型 + private String Amount; // 订单总金额 + private String AmountRMB; // 订单金额(人民币) + private String CustomPayAmount; // 自定义支付金额 + private String SettlementAmount; // 结算金额 + private String PostAmount; // 邮寄金额 + private String PayType; // 支付类型 + private String CustomPayCurrency; // 自定义支付货币 + private String CustomPayExchange; // 自定义支付汇率 + private String SettlementCurrency; // 结算货币 + private String SettlementExchange; // 结算汇率 + private String IsMixPayment; // 是否混合支付 + private String SettlementACCNTAmt; // 结算账户金额 + private String SettlementPersonAmt; // 结算个人金额 + private String AddedFees; // 额外费用 + private String FrontendServiceFee; // 前端服务费 + private String HotelType; // 酒店类型 + private String HotelName; // 酒店名称 + private String HotelEnName; // 酒店英文名称 + private String StarLicence; // 星级许可 + private String Star; // 星级 + private String CustomerEval; // 客户评价 + private String Telephone; // 电话号码 + private String Address; // 地址 + private String StartTime; // 入住开始时间 + private String EndTime; // 入住结束时间 + private String ProvinceEname; // 省份英文名 + private String CityID; // 城市ID + private String CityName; // 城市名称 + private String CityEnName; // 城市英文名称 + private String RoomName; // 房间名称 + private String IsDomestic; // 是否国内 + private String RoomType; // 房间类型 + private String MealType; // 餐食类型 + private String MasterHotelID; // 主酒店ID + private String DistrictID; // 区域ID + private String DistrictName; // 区域名称 + private String OrderStatus; // 订单状态 + private String OrderDetailStatus; // 订单详细状态 + private String OrderDetailStatusName; // 订单详细状态名称 + private String OrderDate; // 订单日期 + private String LastCancelTime; // 最后取消时间 + private String CancelTime; // 取消时间 + private String CancelReasonCode; // 取消原因代码 + private String CancelReasonDesc; // 取消原因描述 + private String FundAccount; // 资金账户 + private String SubAccount; // 子账户 + private String BalanceType; // 余额类型 + private String CorpPayType; // 公司支付类型 + private String ContactEmail; // 联系人邮箱 + private String ContactName; // 联系人姓名 + private String ContactTel; // 联系人电话 + private String HotelConfirmNo; // 酒店确认号 + private String JourneyNo; // 旅程编号 + private String CostCenter; // 成本中心 + // 后续字段含义类似,可根据实际情况添加注释 + private List ClientInfo; // 客户信息列表 +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AccountPaymentInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AccountPaymentInfo.java new file mode 100644 index 00000000..28511a7c --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AccountPaymentInfo.java @@ -0,0 +1,17 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// AccountPaymentInfo内部类定义 +@Data +public class AccountPaymentInfo { + private long DealID; + private int AccountID; + private int SubAccountID; + private String OrderID; + private double Amount; + private String Category; + private String DataChange_CreateTime; + private String TrainRelatedNo; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AfterTakeTicket.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AfterTakeTicket.java new file mode 100644 index 00000000..0e187824 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/AfterTakeTicket.java @@ -0,0 +1,25 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// AfterTakeTicket内部类定义 +@Data +public class AfterTakeTicket { + private long AfterTakeTicketId; + private String CompanyId; + private String CompanyName; + private String ContactName; + private String ContactPhone; + private String CountryCode; + private String Address; + private String DeliverTime; + private String NoticeCtripTime; + private String CtripTakeTicketTime; + private String CtripDeliverTime; + private String TakeType; + private String TakeTicketStatus; + private String FailReason; + private String ExpressCompany; + private String ExpressNo; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/FundAccountDealInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/FundAccountDealInfo.java new file mode 100644 index 00000000..ec649283 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/FundAccountDealInfo.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + + +import lombok.Data; + +@Data +public class FundAccountDealInfo { + private double Amount; + private String Category; + private long DealID; + // 可以根据需要继续添加更多的字段 +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/OrderPayment.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/OrderPayment.java new file mode 100644 index 00000000..d24af7e0 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/OrderPayment.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// OrderPayment内部类定义 +@Data +public class OrderPayment { + private String PaymentType; + private String FeeCode; + private double FeeAmount; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PassengerInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PassengerInfo.java new file mode 100644 index 00000000..8d25540f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PassengerInfo.java @@ -0,0 +1,24 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// PassengerInfo内部类定义 +@Data +public class PassengerInfo { + private long PassengerID; + private String PassengerName; + private String IdentityTypeName; + private String IdentityNo; + private String Birthday; + private String TicketTypeName; + private int InsuranceProductID; + private int PurchaseNumber; + private int TicketPresentNum; + private String CostCenter1; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String EmployeeID; + private String CorpUserID; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PaymentInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PaymentInfo.java new file mode 100644 index 00000000..9e428b73 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/PaymentInfo.java @@ -0,0 +1,14 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// PaymentInfo内部类定义 +@Data +public class PaymentInfo { + private double Amount; + private double ExchangeRate; + private String Currency; + private String DealType; + private String PayWayID; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfo.java new file mode 100644 index 00000000..15457e8b --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfo.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +import java.util.List; + +// SettlementInfo内部类定义 +@Data +public class SettlementInfo { + private List FundAccountDealInfos; + private List SettlementInfos; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfoDetail.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfoDetail.java new file mode 100644 index 00000000..53700475 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/SettlementInfoDetail.java @@ -0,0 +1,23 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +@Data +public class SettlementInfoDetail { + private long OrderTicketID; + private long PassengerID; + private String PassengerName; + private double TicketPrice; + private double InsuranceFee; + private double ServiceFee; + private double RefundTicketFee; + private double DeliverFee; + private double PaperTicketFee; + private double ChangeServiceFee; + private double GrabServiceFee; + private long DealID; + private String TicketInfoID; + private double AfterTakeTicketFee; + private double PurchaseFee; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TicketInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TicketInfo.java new file mode 100644 index 00000000..83a848df --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TicketInfo.java @@ -0,0 +1,21 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// TicketInfo内部类定义 +@Data +public class TicketInfo { + private long TicketInfoID; + private String TrainName; + private String DepartureCityName; + private String DepartureDateTime; + private String ArrivalCityName; + private String ArrivalDateTime; + private String FirstSeatTypeName; + private double TicketPrice; + private String ElectronicOrderNo; + private double ServiceFee; + private String TicketEntrance; + private String DealID; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainBasicInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainBasicInfo.java new file mode 100644 index 00000000..e76e1b33 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainBasicInfo.java @@ -0,0 +1,44 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + + +import lombok.Data; + +@Data +public class TrainBasicInfo { + private String OrderID; + private String TripID; + private String EmployeeID; + private double OrderAmount; + private double DealAmount; + private int TotalQuantity; + private String Remark; + private boolean NeedInvoice; + private boolean IsIncludeInsuranceInvoice; + private int OrderTicketType; + private String OrderTicketTypeDesc; + private String OrderStatus; + private String OrderType; + private String OrderTypeDesc; + private double ServiceFee; + private String ContactName; + private String ContactMobile; + private String ContactEmail; + private String UID; + private String UserName; + private String RefundTicketStatus; + private String PaymentType; + private String DataChange_CreateTime; + private double DeliverFee; + private double PaperTicketFee; + private String AccountName; + private String ConfirmPerson; + private String AuditResult; + private String AuditResultDesc; + private String OrderStatusName; + private double ChangeServiceFee; + private String ServerFrom; + private String CorporationId; + private boolean NeedBigInvoice; + private String CountryCode; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainCorpOrderInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainCorpOrderInfo.java new file mode 100644 index 00000000..75588f1e --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainCorpOrderInfo.java @@ -0,0 +1,24 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +// CorpOrderInfo内部类定义 +@Data +public class TrainCorpOrderInfo { + private String CorporationID; + private int AccountID; + private int SubAccountID; + private String CorpPayType; + private String CostCenter1; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String JourneyReason; + private String Project; + private String JouneryID; + private String JourneyID; + private String CorporationName; + private String RcCodeID; + private String RcCodeName; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainDeliveryInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainDeliveryInfo.java new file mode 100644 index 00000000..0a4461f7 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainDeliveryInfo.java @@ -0,0 +1,15 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +@Data +public class TrainDeliveryInfo { + private String ShipAddress; + private String ShipAddressDetail; + private String ShipZipCode; + private String ShipReceiverMobile; + private String ShipReceiverName; + private String ShipReceiverTel; + private String CountryCode; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainOrderInfoEntity.java new file mode 100644 index 00000000..8b85ff74 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainOrderInfoEntity.java @@ -0,0 +1,26 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + + +import lombok.Data; + +import java.util.List; + +@Data +public class TrainOrderInfoEntity { + private TrainBasicInfo BasicInfo; + private List PassengerInfoList; + private List TicketInfoList; + private List PaymentInfoList; + private SettlementInfo Settlementinfo; + private Object OrderRemarkInfoList; // 假设这是一个空类或未提供详细结构的字段 + private Object InsuranceInfoList; // 假设这是一个空类或未提供详细结构的字段 + private TrainDeliveryInfo DeliveryInfo; + private TrainCorpOrderInfo CorpOrderInfo; + private List AccountPaymentInfoList; + private TrainTicketDeliveryInfo TicketDeliveryInfo; + private Object OrderTicketInvoiceList; // 假设这是一个空类或未提供详细结构的字段 + private Object InvoiceImageList; // 假设这是一个空类或未提供详细结构的字段 + private Object ControlList; // 假设这是一个空类或未提供详细结构的字段 + private List OrderPaymentList; + private List AfterTakeTicketList; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainTicketDeliveryInfo.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainTicketDeliveryInfo.java new file mode 100644 index 00000000..b764ddd9 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/train/TrainTicketDeliveryInfo.java @@ -0,0 +1,19 @@ +package com.chint.interfaces.rest.ctrip.dto.search.train; + +import lombok.Data; + +@Data +public class TrainTicketDeliveryInfo { + private String OrderID; + private int AreaID; + private String Province; + private String City; + private String Area; + private String Address; + private String ShipmentCompany; + private String ShipmentNo; + private String DeliverStatus; + private String DeliverFailMessage; + private String CountryCode; + // 可以根据需要继续添加更多的字段 +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java index 8e4450e5..1557611b 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java @@ -17,7 +17,7 @@ public class LYLoginRequest { @Autowired private LYPostRequest postRequest; - private String loginUrl = L_Y_BASE_URL + L_Y_LOGIN_PATH; + private final String loginUrl = L_Y_BASE_URL + L_Y_LOGIN_PATH; public LYRedirectUrlResponse login(Integer entrance) { User currentUser = BaseContext.getCurrentUser(); @@ -30,4 +30,16 @@ public class LYLoginRequest { loginTokenData.setParam(loginParam); return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class); } + + public LYRedirectUrlResponse loginPC(Integer entrance) { + User currentUser = BaseContext.getCurrentUser(); + LoginTokenData loginTokenData = new LoginTokenData(); + LoginParam loginParam = new LoginParam(); + loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo())); + loginParam.setPlat(L_Y_PLAT_PC); + loginParam.setEntrance(entrance); + loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL); + loginTokenData.setParam(loginParam); + return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class); + } } diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java index 47236523..47b02510 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java @@ -19,7 +19,7 @@ public class LYPostRequest { @Autowired private LYTokenRequest lyTokenRequest; - private String mySecret = L_Y_SECRET; + private final String mySecret = L_Y_SECRET; public T post(String url, LYBaseRequest jsonRequest, Class responseType) { String token = lyTokenRequest.loadToken(); diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYSearchRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYSearchRequest.java new file mode 100644 index 00000000..5180df51 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/LYSearchRequest.java @@ -0,0 +1,58 @@ +package com.chint.interfaces.rest.ly; + +import com.chint.interfaces.rest.ly.dto.search.request.LyOrderDetailRequest; +import com.chint.interfaces.rest.ly.dto.search.request.LySearchRequest; +import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightListResponse; +import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail; +import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; +import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelListResponse; +import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; +import com.chint.interfaces.rest.ly.dto.search.response.train.TrainListResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.Constant.*; + +@Component +public class LYSearchRequest { + + private final String flightListUrl = L_Y_BASE_URL + L_Y_FLIGHT_LIST_PATH; + private final String flightDetailUrl = L_Y_BASE_URL + L_Y_FLIGHT_DETAIL_PATH; + private final String trainListUrl = L_Y_BASE_URL + L_Y_TRAIN_LIST_PATH; + private final String trainDetailUrl = L_Y_BASE_URL + L_Y_TRAIN_DETAIL_PATH; + private final String hotelListUrl = L_Y_BASE_URL + L_Y_HOTEL_LIST_PATH; + private final String hotelDetailUrl = L_Y_BASE_URL + L_Y_HOTEL_DETAIL_PATH; + + @Autowired + private LYPostRequest postRequest; + + public FlightListResponse getFlightOrderListByOrderId(String travelApplyNo) { + LySearchRequest lySearchRequest = LySearchRequest.of(travelApplyNo); + return postRequest.post(flightListUrl, lySearchRequest, FlightListResponse.class); + } + + public FlightOrderDetail getFlightOrderDetail(String orderNo) { + LyOrderDetailRequest lyOrderDetailRequest = LyOrderDetailRequest.of(orderNo); + return postRequest.post(flightDetailUrl, lyOrderDetailRequest, FlightOrderDetail.class); + } + + public TrainListResponse getTrainOrderListByOrderId(String travelApplyNo) { + LySearchRequest lySearchRequest = LySearchRequest.of(travelApplyNo); + return postRequest.post(trainListUrl, lySearchRequest, TrainListResponse.class); + } + + public TrainDetailResponse getTrainOrderDetail(String orderNo) { + LyOrderDetailRequest lyOrderDetailRequest = LyOrderDetailRequest.of(orderNo); + return postRequest.post(trainDetailUrl, lyOrderDetailRequest, TrainDetailResponse.class); + } + + public HotelListResponse getHotelOrderListByOrderId(String travelApplyNo) { + LySearchRequest lySearchRequest = LySearchRequest.of(travelApplyNo); + return postRequest.post(hotelListUrl, lySearchRequest, HotelListResponse.class); + } + + public HotelDetailResponse getHotelOrderDetail(String orderNo) { + LyOrderDetailRequest lyOrderDetailRequest = LyOrderDetailRequest.of(orderNo); + return postRequest.post(hotelDetailUrl, lyOrderDetailRequest, HotelDetailResponse.class); + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYTokenRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYTokenRequest.java index 50d8a2c6..cb13be1d 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYTokenRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYTokenRequest.java @@ -16,7 +16,7 @@ import static com.chint.infrastructure.constant.Constant.*; @Component public class LYTokenRequest { - private String tokenUrl = L_Y_BASE_URL + L_Y_TOKEN_PATH; + private final String tokenUrl = L_Y_BASE_URL + L_Y_TOKEN_PATH; @Autowired private PostRequest postRequest; diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java index f8a2d9d9..797a0d06 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java @@ -26,7 +26,7 @@ public class LYUserRequest { @Autowired private UserHttpRequest userHttpRequest; - private String userUrl = L_Y_BASE_URL + L_Y_USER_PATH; + private final String userUrl = L_Y_BASE_URL + L_Y_USER_PATH; public boolean saveCurrentUser() { System.out.println("saveCurrentUser"); diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseResponse.java new file mode 100644 index 00000000..3c212753 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseResponse.java @@ -0,0 +1,10 @@ +package com.chint.interfaces.rest.ly.dto; + +import lombok.Data; + +@Data +public class LYBaseResponse { + private boolean success; + private String errorCode; + private String errorMessage; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/LYSearchPageInfo.java b/src/main/java/com/chint/interfaces/rest/ly/dto/LYSearchPageInfo.java new file mode 100644 index 00000000..8f0bbff5 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/LYSearchPageInfo.java @@ -0,0 +1,11 @@ +package com.chint.interfaces.rest.ly.dto; + +import lombok.Data; + +@Data +public class LYSearchPageInfo { + private Integer pageIndex; + private Integer pageSize; + private Integer pageCount; + private Integer dataCount; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequest.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequest.java new file mode 100644 index 00000000..311922aa --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequest.java @@ -0,0 +1,20 @@ +package com.chint.interfaces.rest.ly.dto.search.request; + +import com.chint.interfaces.rest.ly.dto.LYBaseRequest; +import lombok.Data; + +import static com.chint.infrastructure.constant.Constant.L_Y_APP_ID; + +@Data +public class LyOrderDetailRequest extends LYBaseRequest { + private LyOrderDetailRequestParam param; + + public static LyOrderDetailRequest of(String orderNo) { + LyOrderDetailRequestParam lyOrderDetailRequestParam = new LyOrderDetailRequestParam(); + LyOrderDetailRequest lyOrderDetailRequest = new LyOrderDetailRequest(); + lyOrderDetailRequestParam.setOrderNo(orderNo); + lyOrderDetailRequestParam.setOutEnterpriseId(L_Y_APP_ID); + lyOrderDetailRequest.setParam(lyOrderDetailRequestParam); + return lyOrderDetailRequest; + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequestParam.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequestParam.java new file mode 100644 index 00000000..9fe6a7a2 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LyOrderDetailRequestParam.java @@ -0,0 +1,12 @@ +package com.chint.interfaces.rest.ly.dto.search.request; + +import lombok.Data; + +@Data +public class LyOrderDetailRequestParam { + private String orderNo; + private String outOrderNo; + private String orderSerialNo; + private String businessTravelOrderNo; + private String outEnterpriseId; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequest.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequest.java new file mode 100644 index 00000000..51a48bbc --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequest.java @@ -0,0 +1,27 @@ +package com.chint.interfaces.rest.ly.dto.search.request; + +import com.chint.infrastructure.util.BaseContext; +import com.chint.interfaces.rest.ly.dto.LYBaseRequest; +import lombok.Data; + +import static com.chint.infrastructure.constant.Constant.L_Y_APP_ID; + +@Data +public class LySearchRequest extends LYBaseRequest { + private Integer errorType; + private LySearchRequestParam param; + + public static LySearchRequest of(String travelApplyNo) { + LySearchRequestParam lySearchRequestParam = new LySearchRequestParam(); + lySearchRequestParam.setOutEmployeeId(String.valueOf( + BaseContext.getCurrentUser().getEmployeeNo() + )); + lySearchRequestParam.setPageIndex(1); + lySearchRequestParam.setPageSize(9999); + lySearchRequestParam.setOutEnterpriseId(L_Y_APP_ID); + lySearchRequestParam.setTravelApplyNo(travelApplyNo); + LySearchRequest lySearchRequest = new LySearchRequest(); + lySearchRequest.setParam(lySearchRequestParam); + return lySearchRequest; + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequestParam.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequestParam.java new file mode 100644 index 00000000..751868cd --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/request/LySearchRequestParam.java @@ -0,0 +1,15 @@ +package com.chint.interfaces.rest.ly.dto.search.request; + +import lombok.Data; + +@Data +public class LySearchRequestParam { + private String outEnterpriseId; + private String outEmployeeId; + private String bookStartTime; + private String bookEndTime; + private String travelApplyNo; + private Integer pageIndex; + private Integer pageSize; + private Integer queryTravelType; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightListResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightListResponse.java new file mode 100644 index 00000000..e0cb94ce --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightListResponse.java @@ -0,0 +1,29 @@ +package com.chint.interfaces.rest.ly.dto.search.response.filght; + +import com.chint.interfaces.rest.ly.dto.LYBaseResponse; +import lombok.Data; + +import java.util.List; + +@Data +public class FlightListResponse extends LYBaseResponse { + private List data; + @Data + private static class FlightOrder { + private String orderSerialNo; // 机票订单号 + private String originalOrderNo; // 原订单号(祖先单) + private String parentOrderSerialNo; // 父订单号 + private Integer orderType; // 订单类型 0.国际 1.国内 + private String travelApplyNo; // 外部出差申请单号 + private Integer travelType; // 差旅类型 1.因公 2.因私 + private Integer payType; // 支付方式 1.公司授信 2.个人支付 3.组合支付 + private String outEmployeeId; // 外部员工ID + private Double totalPrice; // 订单总价 + private Integer orderStatus; // 订单状态 + private String orderStatusText; // 订单状态文案 + private Boolean isChangeOrder; // 是否改签单 + private Boolean isRefundOrder; // 是否退票单 + private String bookDate; // 预订时间 + } + +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightOrderDetail.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightOrderDetail.java new file mode 100644 index 00000000..79f110bc --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/filght/FlightOrderDetail.java @@ -0,0 +1,281 @@ +package com.chint.interfaces.rest.ly.dto.search.response.filght; + +import com.chint.interfaces.rest.ly.dto.LYBaseResponse; +import lombok.Data; + +import java.util.List; + +@Data +public class FlightOrderDetail extends LYBaseResponse { + private Data data; + + // Getters and Setters + @lombok.Data + public static class Data { + private OrderDetails orderDetails; + private List flightSegmentList; + private List passengerList; + private TravelData travelData; + private List priceVar; + private List approvalList; + + // Getters and Setters + } + @lombok.Data + public static class OrderDetails { + private String orderSerialNo; + private String originalOrderNo; + private String parentOrderSerialNo; + private String outEmployeeId; + private String employeeCode; + private String relationId; + private int orderStatus; + private String orderStatusText; + private String ticketOutLimitTime; + private int isNeedTransfer; + private int payStatus; + private List contact; + private double totalPrice; + private double servicePrice; + private double afterSettlementServicePrice; + private String pnr; + private String fullPnrNo; + private String memberId; + private String reason; + private int travelType; + private String travelOrderNo; + private int orderType; + private int voyageType; + private String ticketTime; + private int payType; + private String bookDate; + private String payTime; + private boolean isChangeOrder; + private boolean isRefundOrder; + private String outEnterpriseId; + private FlightOrderRefundInfo flightOrderRefundInfo; + private String changeReason; + private String changeNote; + private double adjustTotalDiffPrice; + private List lowestPriceList; + + // Getters and Setters + } + @lombok.Data + public static class Contact { + private String contactName; + private String contactPhone; + private String contactEmail; + + // Getters and Setters + } + @lombok.Data + public static class FlightOrderRefundInfo { + private int refundType; + private String refundTicketTime; + private String refundDate; + private double refundPrice; + private double refundFee; + private double refundServiceFee; + private double afterSettlementRefundServicePrice; + private String refundReason; + private String refundNote; + + // Getters and Setters + } + @lombok.Data + public static class LowestPrice { + private int type; + private double ticketPrice; + private String flightNo; + private String cabinCode; + + // Getters and Setters + } + @lombok.Data + public static class FlightSegment { + private String flightNo; + private String carrier; + private String airline; + private String airlineLogoUrl; + private String departCity; + private String departAirport; + private String departAirportCode; + private String departTerminal; + private String departTimeFull; + private String departTime; + private String arriveTimeFull; + private String arriveTime; + private String arriveCity; + private String arriveAirport; + private String arriveAirportCode; + private String arriveTerminal; + private int days; + private String flightModel; + private String meal; + private int stopCount; + private List stopList; + private int isCheckIn; + private int isFollowChange; + private int isOld; + private int codeShare; + private String shareNum; + private String shareAirlineName; + private String shareAirlineLogoUrl; + private String seatCode; + private String seatName; + private String seatDiscount; + private Rule rule; + private String segmentId; + private String cabinClassCode; + private int segmentIndex; + private int mileAge; + private String departCountryCode; + private String arriveCountryCode; + + // Getters and Setters + } + @lombok.Data + public static class Stop { + private String airportCode; + private String time; + private String airport; + private String airportCityName; + + // Getters and Setters + } + @lombok.Data + public static class Rule { + private String modifyStipulate; + private String tips; + private List rulePointList; + private String seatCode; + private String seatName; + private double seatPrice; + private String baggage; + private int changeRule; + private int refundRule; + + // Getters and Setters + } + @lombok.Data + public static class RulePoint { + private int time; + private String content; + private double refundFeePercent; + private double refundFee; + private double modifyFeePercent; + private double modifyFee; + private String modifyStipulate; + + // Getters and Setters + } + @lombok.Data + public static class Passenger { + private String outEmployeeId; + private String employeeCode; + private String passengerId; + private String parentPassengerId; + private int passengerStatus; + private String ticketNo; + private double salesPrice; + private double parPrice; + private double fuelTax; + private double airportTax; + private double insurancePrice; + private String passengerName; + private String contractPhone; + private int passengerType; + private int identityType; + private String identityNo; + private String birthday; + private int gender; + private String reason; + private double changePrice; + private double changeFee; + private double changeServiceFee; + private double afterSettlementChangeServicePrice; + private boolean canChange; + private boolean canRefund; + private String changeOrderSerialNo; + private String refundOrderSerialNo; + private double serviceFee; + private double afterSettlementServiceFee; + + // Getters and Setters + } + @lombok.Data + public static class TravelData { + private String oaNo; + private String travelApplyNo; + private String travelRemark; + private List submitItemList; + + // Getters and Setters + } + @lombok.Data + public static class SubmitItem { + private String itemCode; + private String itemTitle; + private String itemTitleEn; + private String itemContent; + + // Getters and Setters + } + @lombok.Data + public static class PriceVar { + private String priceVarNo; + private double totalPriceVar; + private int payType; + private int priceVarType; + private String diffReson; + private String priceVarTime; + private List adjustPassengerList; + + // Getters and Setters + } + @lombok.Data + public static class AdjustPassenger { + private String outEmployeeId; + private String passengerId; + private String ticketNo; + private String passengerName; + private double salesPriceVar; + private double parPriceVar; + private double fuelTaxVar; + private double airportTaxVar; + private double changePriceVar; + private double changeFeeVar; + private double changeServiceFeeVar; + private double afterChangeServiceFeeVar; + private double serviceFeeVar; + private double afterServiceFeeVar; + private double refundServiceFeeVar; + private double afterRefundServiceFeeVar; + private double refundFeeVar; + private double refundPriceVar; + private double airportTaxDiffVar; + private double fuelTaxDiffVar; + + // Getters and Setters + } + @lombok.Data + public static class Approval { + private int orderType; + private List approverList; + private List approveOrderNoList; + + // Getters and Setters + } + @lombok.Data + public static class Approver { + private String outEmployeeId; + private String approverName; + private int level; + private String approvalResult; + private String approvalTime; + private String approvalRemark; + + // Getters and Setters + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java new file mode 100644 index 00000000..02ba2657 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java @@ -0,0 +1,239 @@ +package com.chint.interfaces.rest.ly.dto.search.response.hotel; + +import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.ContactPerson; +import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo; +import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; +import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail; +import lombok.Data; + +import java.util.List; + +@Data +public class HotelDetailResponse { + private Data data; + + // Getters and Setters + + @lombok.Data + public static class Data { + private OrderInfo orderInfo; + private HotelInfo hotelInfo; + private List dayPrices; + private List contactPersons; + private List residentList; + private List roomList; + private List refundInfoList; + private FlightOrderDetail.TravelData travelData; + private List orderGiftInfoList; + private List priceVarInfoList; + private List approvalList; + + // Getters and Setters + } + @lombok.Data + public static class OrderInfo { + private String orderSerialNo; + private String travelOrderNo; + private String businessTravelOrderNo; + private int protocolType; + private double totalStandardPrice; + private double saveTotalPrice; + private int orderStatus; + private String orderStatusDesc; + private int payStatus; + private boolean isSelf; + private String createTime; + private double totalPrice; + private double totalCost; + private double roomTotalPrice; + private double servicePrice; + private double afterSettlementServicePrice; + private String contactName; + private String contactPhone; + private String contactEmail; + private String refundRule; + private String refundIntro; + private String servicePhone; + private boolean canRefund; + private boolean canChange; + private double payPrice; + private double personalPrice; + private double companyPrice; + private String supplierOrderCreateTime; + private String employeeName; + private String enterpriseName; + private String outEmployeeId; + private String employeeCode; + private int orderType; + private int cancelType; + private String cancelTime; + private String originalCheckInDate; + private String originalCheckOutDate; + private String confirmNos; + private String hotelConfirmNos; + private int refundReason; + private int travelType; + private long departmentId; + private String departmentName; + private String cancelReasons; + private boolean isGuarantee; + private int guaranteeMode; + private int guaranteePriceType; + private double guaranteePrice; + private CreditCardInfo creditCardInfo; + private boolean isGuaranteeRate; + private String travelApplyNo; + private String outTravelApplyNo; + private String outEnterpriseId; + private int payType; + private int paymentType; + private int customerInvoiceCode; + private String customerInvoiceDesc; + private double adjustTotalDiffPrice; + private int halfDayRoom; + private double businessAmount; + + // Getters and Setters + } + @lombok.Data + public static class CreditCardInfo { + private String cardNumber; + private String cardType; + private String holderName; + + // Getters and Setters + } + + // Definitions for other nested classes (HotelInfo, DayPrice, etc.) follow the same structure + @lombok.Data + public static class HotelInfo { + private String orderSerialNo; + private String hotelId; + private String hotelName; + private String hotelAddress; + private long cityId; + private String cityName; + private String checkInDate; + private String checkOutDate; + private String hotelTel; + private int checkInTime; + private String roomName; + private String bedType; + private String breakfast; + private int roomNum; + private int nightNum; + private double lon; + private double lat; + private String bedRemark; + private String earliestToHotel; + private String latestToHotel; + + // Getters and Setters + } + + // Define other nested classes (DayPrice, ContactPerson, Resident, Room, RefundInfo, etc.) in a similar manner + @lombok.Data + public static class DayPrice { + private String date; + private String dateStr; + private double price; + private String breakfast; + private int roomAmount; + private double marketPrice; + private double saveprice; + + // Getters and Setters + } + @lombok.Data + public static class Room { + private String productOrderSerialNo; + private List passengerIdList; // Assuming IDs are numeric + private List passengerNameList; + private String checkInDate; + private String checkOutDate; + private String confirmNo; + private int orderStatus; + private String orderStatusDesc; + private double salesPrice; + private double marketPrice; + private double savePrice; + private double standardPrice; + private String dayStandardPrice; // Assuming this is a string representation of the price + private double costPrice; + private double servicePrice; + private double afterSettlementServicePrice; + private String previousProductOrderSerialNo; + private CheckRoomInfo checkRoomInfo; // Assuming this is a nested object with its own structure + private double companyPrice; + private double personalPrice; + private String refundReason; + private String changeReason; + + // Getters and Setters + } + @lombok.Data + public static class CheckRoomInfo { + private int hotelCheckInStatus; + private String checkInDate; + private String checkOutDate; + + // Getters and Setters + } + @lombok.Data + public static class OrderGiftInfo { + private String giftTitle; + private String giftContent; + private int giftSource; // Assuming this is an integer representing the source + private int giftProvider; // Assuming this is an integer representing the provider + private String giftDateDesc; // Assuming this is a string description of the date + private int giftStatus; // Assuming this is an integer representing the status + + // Getters and Setters + } + @lombok.Data + public static class PriceVarInfo { + private String priceVarNo; + private double totalPriceVar; + private int paymentTypeVar; + private double companyPriceVar; + private double personalPriceVar; + private int priceVarType; // Assuming this is an integer representing the type of price variation + private String priceVarTime; + private List adjustRoomList; // Assuming this is a list of AdjustRoom objects, each with its own structure + + // Getters and Setters + } + @lombok.Data + public static class AdjustRoom { + private String productOrderSerialNo; + private double roomTotalPriceVar; + private double salesPriceVar; + private double costPriceVar; + private double servicePriceVar; + private double afterServicePriceAdjustmentValue; + private double refundFeeVar; + private double changeFeeVar; + private double refundAmountVar; + + // Getters and Setters + } + @lombok.Data + public static class Approval { + private int orderType; // Assuming this is an integer representing the type of order + private List approverList; // Assuming this is a list of Approver objects, each with its own structure + private List approveOrderNoList; // Assuming this is a list of strings representing order numbers + + // Getters and Setters + } + + @lombok.Data + public static class Approver { + private String outEmployeeId; + private String approverName; + private int level; // Assuming this is an integer representing the approval level + private String approvalResult; // Assuming this is a string representing the result of the approval + private String approvalTime; + private String approvalRemark; // Assuming this is a string representing any remarks + // Getters and Setters + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelListResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelListResponse.java new file mode 100644 index 00000000..7909e6f6 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelListResponse.java @@ -0,0 +1,34 @@ +package com.chint.interfaces.rest.ly.dto.search.response.hotel; + +import com.chint.interfaces.rest.ly.dto.LYBaseResponse; +import lombok.Data; + +import java.util.List; + +@Data +public class HotelListResponse extends LYBaseResponse { + private List orderList; + + @Data + private static class HotelOrder{ + private String orderSerialNo; + private int orderType; + private String roomName; + private int nightAmount; + private int roomAmount; + private List travelers; + private double servicePrice; + private String checkOutDate; + private String checkInDate; + private double payPrice; + private double totalPrice; + private int orderStatus; + private String orderStatusDesc; + private long enterpriseId; // Assuming enterpriseId can be a large number + private long employeeId; // Assuming employeeId can be a large number + private String travelOrderNo; + private String hotelName; + private int paymentType; + + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java new file mode 100644 index 00000000..3217e55b --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java @@ -0,0 +1,237 @@ +package com.chint.interfaces.rest.ly.dto.search.response.train; + +import lombok.Data; + +import java.util.List; + +@Data +public class TrainDetailResponse { + private TrainDetailData data; + + @Data + public static class TrainDetailData { + private String outEmployeeId; + private String employeeCode; + private String orderNo; + private String parentOrderSerialNo; + private int isChangedOrder; + private String outOrderNo; + private List relatedOrderList; + private String trainNo; + private String orderStatus; + private String orderStatusName; + private int isNeedTransfer; + private String fromStation; + private String toStation; + private String fromStationCode; + private String toStationCode; + private String departCity; + private String arriveCity; + private String planBeginDate; + private String planEndDate; + private String trainClass; + private String ticketNo; + private String occupySeatTime; + private String outTicketTime; + private String refundTime; + private int ticketModel; + private int createOrderPattern; + private String accountNo; + private String ticketGate; + private int acceptNoSeat; + private List items; + private ContactInfo contactInfo; + private GarbInfo garbInfo; + private double totalAmount; + private TravelData travelData; + private int bookingMethod; + private int paymentType; + private double personalPrice; + private double companyPrice; + private List priceVarList; + private List approvalList; + private int bookType; + private int trainIndex; + private String relationOrderNo; + + // Constructors, Getters, and Setters + } + @Data + public static class Item { + private long itemId; + private String employeeCode; + private long parentItemId; + private String outEmployeeId; + private String ticketStatus; + private String passengerName; + private String certificateTypeCode; + private String certificateCode; + private String passengerSex; + private String passengerBirthDay; + private String passengerPhone; + private String passengerClass; + private String passengerTicketNo; + private String seatClass; + private String seatNo; + private double ticketPrice; + private double serviceCharge; + private double afterServiceCharge; + private double refundAmount; + private double refundCharge; + private double refundFee; + private double changePrice; + private double changeFee; + private double changeRefundFee; + private double changeRebookFee; + private double refundAmountPer; + private double refundAmountCor; + private double personalPrice; + private double companyPrice; + private ChangeInfo changeInfo; + private String refundReason; + private double refunedAmount; + + // Constructors, Getters, and Setters + } + + @Data + public static class ChangeInfo { + private String changeReason; + private String orderNo; + private String outOrderNo; + private String orderStatus; + private String fromStation; + private String toStation; + private String fromStationCode; + private String toStationCode; + private String planBeginDate; + private String planEndDate; + private String trainClass; + private String trainNo; + private String ticketNo; + private String occupySeatTime; + private String outTicketTime; + private String ticketGate; + private String changeType; + private ChangeItem changeItem; + private int bookingMethod; + + // Constructors, Getters, and Setters + } + + @Data + public static class ChangeItem { + private long itemId; + private String ticketStatus; + private String passengerTicketNo; + private String seatClass; + private String seatNo; + private double ticketPrice; + private double serviceCharge; + private double afterServiceCharge; + private double changeFee; + private double changeRefundFee; + private double changeRebookFee; + private double refundAmount; + private double refundCharge; + private double afterRefundCharge; + private double refundFee; + private double changePrice; + private double refundAmountPer; + private double refundAmountCor; + private double personalPrice; + private double companyPrice; + + // Constructors, Getters, and Setters + } + + @Data + public static class ContactInfo { + private String personName; + private String personMobile; + private String personTelephone; + private String personEmail; + + // Constructors, Getters, and Setters + } + @Data + public static class GarbInfo { + private String trainNo; + private String trainClass; + private String seatClassCode; + private String closeTime; // Assuming this is a string, but consider using Date if it represents a specific time + + // Constructors, Getters, and Setters + } + @Data + public static class TravelData { + private String oaNo; + private String travelApplyNo; + private String travelRemark; + private List submitItemList; + + // Constructors, Getters, and Setters + @Data + public static class SubmitItem { + private String itemCode; + private String itemTitle; + private String itemTitleEn; + private String itemContent; + + // Constructors, Getters, and Setters + } + } + @Data + public static class PriceVar { + private String priceVarNo; + private double totalPriceVar; + private int paymentTypeVar; + private double companyPriceVar; + private double personalPriceVar; + private int priceVarType; + private String priceVarTime; + private List passengers; + + // Constructors, Getters, and Setters + @Data + public static class PassengerPriceVar { + private long itemId; + private String outEmployeeId; + private String passengerName; + private String pTicketNo; + private double serviceChargeVar; + private double changePriceDiffVar; + private double changeServicePriceVar; + private double afterChangeServicePriceVar; + private double priceVar; + private double servicePriceVar; + private double afterServicePriceVar; + private double refundPriceVar; + private double refundFeeVar; + private double refundServicePriceVar; + private double afterRefundServicePriceVar; + + // Constructors, Getters, and Setters + } + } + @Data + public static class Approval { + private int orderType; + private List approverList; + private List approveOrderNoList; + + // Constructors, Getters, and Setters + + @Data + public static class Approver { + private String outEmployeeId; + private String approverName; + private int level; + private String approvalResult; + private String approvalTime; + private String approvalRemark; + + // Constructors, Getters, and Setters + } + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainListResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainListResponse.java new file mode 100644 index 00000000..83f1fef9 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainListResponse.java @@ -0,0 +1,33 @@ +package com.chint.interfaces.rest.ly.dto.search.response.train; + +import com.chint.interfaces.rest.ly.dto.LYBaseResponse; +import lombok.Data; + +import java.util.List; + +@Data +public class TrainListResponse extends LYBaseResponse { + private List trainOrderList; + + @Data + private class TrainOrder { + private String orderSerialNo; + private String originalOrderNo; + private String parentOrderSerialNo; + private String travelApplyNo; + private int travelType; + private int payType; + private String outEmployeeId; + private double totalPrice; + private String orderStatus; + private String orderStatusText; + private boolean isChangeOrder; + private boolean hasRefund; + private String bookDate; + private int bookType; + private int trainIndex; + private String relationOrderNo; + + // Constructors, Getters, and Setters + } +} 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 11dd4320..ebab87a4 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -2,9 +2,9 @@ package com.chint.interfaces.rest.user; -import com.chint.dc.api.DataCenterResult; -import com.chint.dc.api.dto.DataCenterOption; -import com.chint.dc.api.service.DataCenterService; +//import com.chint.dc.api.DataCenterResult; +//import com.chint.dc.api.dto.DataCenterOption; +//import com.chint.dc.api.service.DataCenterService; import com.chint.domain.aggregates.user.User; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.user.dto.*; @@ -40,13 +40,13 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private User loadSFAndRank(User user) { - List loadSFInfo = loadSFInfo(user); - String custManaLevel = loadSFInfo.get(0).getCust_manaLevel(); - String level = custManaLevel != null ? custManaLevel : "M0"; - if (level.contains("R")) { - level = level.substring(0, level.length() - 3) + "M0"; - } - TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level)); +// List loadSFInfo = loadSFInfo(user); +// String custManaLevel = loadSFInfo.get(0).getCust_manaLevel(); +// String level = custManaLevel != null ? custManaLevel : "M0"; +// if (level.contains("R")) { +// level = level.substring(0, level.length() - 3) + "M0"; +// } +// TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level)); // user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE()); user.setRankCode("测试职级"); return user; @@ -67,31 +67,31 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private List loadSFInfo(User user) { - Gson gson = new Gson(); - AccessKeyDTO akSkLoad = akSkLoad(); - DataCenterOption option = new DataCenterOption(); - option.setSk(akSkLoad.sk); - option.setAk(akSkLoad.ak); - option.setUrl(OPENAI_BASE_URL); - DataCenterService dataCenterService = new DataCenterService(option); - LinkedHashMap map = new LinkedHashMap(); - map.put("LoginUsername", user.getEmployeeNo().toString()); - map.put("start", 0); - map.put("pageSize", 1); - DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); - Type type = new TypeToken>() { - }.getType(); - if (result.getData() != null) { - List fromJson = gson.fromJson(result.getData().toString(), type); - UserDataDTO userDataDTO = fromJson.get(0); - user.setCompanyCode(userDataDTO.getCompany()); - user.setWorkStatus(userDataDTO.getStatus()); - user.setGender(userDataDTO.getGender()); - return fromJson; - } else { - throw new RuntimeException("用户数据不存在"); - } -// return null; +// Gson gson = new Gson(); +// AccessKeyDTO akSkLoad = akSkLoad(); +// DataCenterOption option = new DataCenterOption(); +// option.setSk(akSkLoad.sk); +// option.setAk(akSkLoad.ak); +// option.setUrl(OPENAI_BASE_URL); +// DataCenterService dataCenterService = new DataCenterService(option); +// LinkedHashMap map = new LinkedHashMap(); +// map.put("LoginUsername", user.getEmployeeNo().toString()); +// map.put("start", 0); +// map.put("pageSize", 1); +// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); +// Type type = new TypeToken>() { +// }.getType(); +// if (result.getData() != null) { +// List fromJson = gson.fromJson(result.getData().toString(), type); +// UserDataDTO userDataDTO = fromJson.get(0); +// user.setCompanyCode(userDataDTO.getCompany()); +// user.setWorkStatus(userDataDTO.getStatus()); +// user.setGender(userDataDTO.getGender()); +// return fromJson; +// } else { +// throw new RuntimeException("用户数据不存在"); +// } + return null; } private TravelRankDTO loadTravelRank(TravelRankParam travelRankParam) { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 81e4b235..9d4aa49f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -10,3 +10,7 @@ chint: database: itinerary_booking username: echo password: R3nd0mP@ssw0rd! +logging: + level: + org.springframework.jdbc.core.JdbcTemplate: DEBUG + org.springframework.jdbc.core.StatementCreatorUtils: TRACE diff --git a/src/main/resources/gitea.yml b/src/main/resources/gitea.yml new file mode 100644 index 00000000..a2ecf0fb --- /dev/null +++ b/src/main/resources/gitea.yml @@ -0,0 +1,26 @@ +version: "3" + +networks: + gitea: + external: false + +services: + server: + image: gitea/gitea:1.21.4 + container_name: gitea + environment: + - USER_UID=1000 + - USER_GID=1000 + - GITEA__database__DB_TYPE=mysql + - GITEA__database__HOST=rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com:3306 + - GITEA__database__NAME=gitea + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea + restart: always + volumes: + - /app/gitea/data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "222:22" \ No newline at end of file diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index fdca100a..7435b3d3 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -3,26 +3,20 @@ package com.chint; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.CityRepository; import com.chint.infrastructure.util.BaseContext; -import com.chint.interfaces.rest.ctrip.CTripEstimateRequest; -import com.chint.interfaces.rest.ctrip.CTripLocationHttpRequest; -import com.chint.interfaces.rest.ctrip.CTripLoginRequest; -import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest; +import com.chint.interfaces.rest.ctrip.*; import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest; import com.chint.interfaces.rest.ctrip.dto.estimate.request.FlightProductInfo; import com.chint.interfaces.rest.ctrip.dto.estimate.request.RouteInfo; import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse; import com.chint.interfaces.rest.ctrip.dto.location.CTripCity; import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry; -import com.chint.interfaces.rest.ctrip.dto.login.CTripAuthLoginParam; import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.util.EntityUtils; +import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; +import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import java.io.IOException; import java.util.List; import java.util.stream.Collectors; @@ -38,6 +32,9 @@ public class CTripTest { @Autowired private CTripEstimateRequest estimateRequest; + @Autowired + private CTripOrderSearchRequest orderSearchRequest; + @Autowired private CityRepository cityRepository; @@ -86,25 +83,9 @@ public class CTripTest { @Test void authLogin() { -// BaseContext.setCurrentUser(user); -// CTripLoginParam cTripLoginParam = new CTripLoginParam(); -// cTripLoginParam.setEmployeeID(String.valueOf(user.getEmployeeNo())); - - CTripAuthLoginParam param = new CTripAuthLoginParam(); - param.setEmployeeID("230615020"); - param.setForCorp(0); - HttpResponse response = loginRequest.authLogin(param); - - HttpEntity entity = response.getEntity(); - String result = null; - try { - result = EntityUtils.toString(entity, "UTF-8"); - } catch (IOException e) { - throw new RuntimeException(e); - } - - System.out.println(result); - + BaseContext.setCurrentUser(user); + PCResponse response = loginRequest.authLogin(); + System.out.println(response.getRedirectUrl()); } @@ -136,4 +117,11 @@ public class CTripTest { System.out.println(estimate); } + @Test + void search() { + BaseContext.setCurrentUser(user); + SearchOrderResponse response = orderSearchRequest.searchOrder("actual12345622"); + System.out.println(response); + } + } diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 38d280ab..1e685cae 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -280,5 +280,11 @@ public class LYTest { System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME)); } + @Test + void loginLYPC() { + BaseContext.setCurrentUser(user); + System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME)); + } + } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index c79bbeb5..4cfad0c4 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -2,6 +2,7 @@ package com.chint; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.util.BaseContext; +import com.chint.infrastructure.util.Digest; import com.chint.interfaces.rest.user.UserHttpRequest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -22,4 +23,15 @@ class RouteApplicationTests { userHttpRequest.loadUserInfo(user); } + @Test + void loginSign(){ + String sfno = "230615020"; + String syscode = "abc"; + String billcode = "12321412323"; + String sec = "Superdandan"; + String timespan = "12312312312312"; + + String s = Digest.md5(sfno + syscode + billcode + sec + timespan); + System.out.println(s); + } }