完善订单详情字段
This commit is contained in:
parent
89ca5cb54f
commit
c79f61e23e
|
@ -7,10 +7,10 @@ import lombok.Data;
|
||||||
import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED;
|
import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RouteAddOrderCommand extends Command {
|
public class RouteUpdateOrderCommand extends Command {
|
||||||
private Integer LegEventType = LEG_EVENT_ORDERED;
|
private Integer LegEventType = LEG_EVENT_ORDERED;
|
||||||
private OrderLegData data;
|
private OrderLegData data;
|
||||||
public RouteAddOrderCommand data(OrderLegData data) {
|
public RouteUpdateOrderCommand data(OrderLegData data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -87,7 +87,7 @@ public class OrderApplicationService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void ordered(OrderLegData data) {
|
public void ordered(OrderLegData data) {
|
||||||
Command.of(RouteAddOrderCommand.class).data(data).sendToQueue();
|
Command.of(RouteUpdateOrderCommand.class).data(data).sendToQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("car_order_detail")
|
||||||
|
public class CarOrderDetail {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("flight_order_detail")
|
||||||
|
public class FlightOrderDetail {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("hotel_order_detail")
|
||||||
|
public class HotelOrderDetail {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -38,6 +38,21 @@ public class OrderDetail {
|
||||||
@MappedCollection(idColumn = "order_id", keyColumn = "order_key")
|
@MappedCollection(idColumn = "order_id", keyColumn = "order_key")
|
||||||
private List<OrderEvent> orderEventList;
|
private List<OrderEvent> orderEventList;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "order_id")
|
||||||
|
private CarOrderDetail carOrderDetail;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "order_id")
|
||||||
|
private FlightOrderDetail flightOrderDetail;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "order_id")
|
||||||
|
private HotelOrderDetail hotelOrderDetail;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "order_id")
|
||||||
|
private TrainOrderDetail trainOrderDetail;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "order_id")
|
||||||
|
private OtherOrderDetail otherOrderDetail;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String orderStatus;
|
private String orderStatus;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.springframework.data.relational.core.mapping.Table;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.*;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.LEG_EVENT_REJECT_NAME;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_event")
|
@Table("order_event")
|
||||||
|
@ -32,6 +31,7 @@ public class OrderEvent {
|
||||||
case ORDER_EVENT_CHANGE -> ORDER_EVENT_CHANGE_NAME;
|
case ORDER_EVENT_CHANGE -> ORDER_EVENT_CHANGE_NAME;
|
||||||
case ORDER_EVENT_CANCEL -> ORDER_EVENT_CANCEL_NAME;
|
case ORDER_EVENT_CANCEL -> ORDER_EVENT_CANCEL_NAME;
|
||||||
case ORDER_EVENT_ORDERED -> ORDER_EVENT_ORDERED_NAME;
|
case ORDER_EVENT_ORDERED -> ORDER_EVENT_ORDERED_NAME;
|
||||||
|
case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME;
|
||||||
default -> "未知事件";
|
default -> "未知事件";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,10 @@ public class OrderEvent {
|
||||||
this.setEventName(translateOrderEvent(this.eventType));
|
this.setEventName(translateOrderEvent(this.eventType));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrderEvent of(Integer eventType) {
|
||||||
|
OrderEvent orderEvent = new OrderEvent();
|
||||||
|
orderEvent.setEventType(eventType);
|
||||||
|
return orderEvent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("other_order_detail")
|
||||||
|
public class OtherOrderDetail {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("train_order_detail")
|
||||||
|
public class TrainOrderDetail {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
package com.chint.domain.factoriy.order_detail;
|
package com.chint.domain.factoriy.order_detail;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.OrderDetail;
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
|
import com.chint.domain.aggregates.order.OrderEvent;
|
||||||
import com.chint.domain.value_object.OrderLegData;
|
import com.chint.domain.value_object.OrderLegData;
|
||||||
|
|
||||||
public interface OrderDetailFactory {
|
public interface OrderDetailFactory {
|
||||||
OrderDetail create(OrderLegData orderLegData);
|
OrderDetail create(OrderLegData orderLegData);
|
||||||
|
|
||||||
|
OrderEvent createEvent(Integer eventType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.domain.factoriy.order_detail;
|
package com.chint.domain.factoriy.order_detail;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.OrderDetail;
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
|
import com.chint.domain.aggregates.order.OrderEvent;
|
||||||
import com.chint.domain.value_object.OrderLegData;
|
import com.chint.domain.value_object.OrderLegData;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -10,4 +11,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
||||||
public OrderDetail create(OrderLegData orderLegData) {
|
public OrderDetail create(OrderLegData orderLegData) {
|
||||||
return OrderDetail.of(orderLegData.getOrderNo(), orderLegData.getSupplierName());
|
return OrderDetail.of(orderLegData.getOrderNo(), orderLegData.getSupplierName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderEvent createEvent(Integer eventType) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@ package com.chint.domain.repository;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.OrderDetail;
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface OrderDetailRepository {
|
public interface OrderDetailRepository {
|
||||||
OrderDetail findById(Long orderDetailId);
|
OrderDetail findById(Long orderDetailId);
|
||||||
|
|
||||||
|
Optional<OrderDetail> findByOrderNo(String orderNo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.chint.application.commands.*;
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.exceptions.CommandException;
|
import com.chint.domain.exceptions.CommandException;
|
||||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||||
|
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||||
import com.chint.domain.repository.LegRepository;
|
import com.chint.domain.repository.LegRepository;
|
||||||
import com.chint.domain.repository.OrderDetailRepository;
|
import com.chint.domain.repository.OrderDetailRepository;
|
||||||
|
@ -17,8 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_APPROVAL;
|
import java.util.Optional;
|
||||||
import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_PREPARE;
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LegEventHandler implements LegEventService {
|
public class LegEventHandler implements LegEventService {
|
||||||
|
@ -38,6 +40,9 @@ public class LegEventHandler implements LegEventService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailFactory orderDetailFactory;
|
private OrderDetailFactory orderDetailFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RouteOrderFactory routeOrderFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailRepository orderDetailRepository;
|
private OrderDetailRepository orderDetailRepository;
|
||||||
|
|
||||||
|
@ -99,28 +104,43 @@ public class LegEventHandler implements LegEventService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void routeAddOrder(RouteAddOrderCommand command) {
|
public void routeUpdateOrder(RouteUpdateOrderCommand command) {
|
||||||
OrderLegData data = command.getData();
|
OrderLegData data = command.getData();
|
||||||
//首先查询到 行程规划订单 , 为形成规划订单添加 外部订单信息
|
|
||||||
OrderDetail orderDetail = orderDetailFactory.create(data)
|
|
||||||
.price(data.getPrice()).productType(data.getProductType());
|
|
||||||
String actualOrderNo = data.getActualOrderNo();
|
String actualOrderNo = data.getActualOrderNo();
|
||||||
RouteOrder routeOrder = routeRepository.findByActualOrderNo(actualOrderNo);
|
RouteOrder routeOrder = routeRepository.findByActualOrderNo(actualOrderNo);
|
||||||
routeOrder.addOrderDetail(orderDetail);
|
//首先查询到行程规划订单 , 从routOrder当中查询是否以及存在该订单
|
||||||
//结合外部订单信息,筛选最合适的leg节点 ,触发下单事件 ;
|
Optional<OrderDetail> byOrderNo = routeOrder.getOrderDetails()
|
||||||
routeOrder.getLegItems()
|
|
||||||
.stream()
|
.stream()
|
||||||
.filter(leg -> leg.getLegType().equals(orderDetail.getProductType())
|
.filter(orderDetail -> orderDetail.getOrderNo().equals(data.getOrderNo()))
|
||||||
&& leg.getDestinationId().equals(orderDetail.getDestinationId())
|
.findFirst();
|
||||||
&& leg.getOriginId().equals(orderDetail.getOriginId())
|
if (byOrderNo.isPresent()) {
|
||||||
&& leg.getStartTime().isBefore(orderDetail.getStartTime())
|
//如果订单以及存在了,对订单的状态进行更新,
|
||||||
&& leg.getEndTime().isAfter(orderDetail.getEndTime()))
|
OrderEvent event = orderDetailFactory.createEvent(data.getOrderStatus());
|
||||||
.findFirst()
|
OrderDetail orderDetail = byOrderNo.get();
|
||||||
.ifPresent(leg -> {
|
orderDetail.addOrderEvent(event);
|
||||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
} else {
|
||||||
legEvent.addOrderDetail(orderDetail);
|
//否则创建新的订单添加到routeOrder
|
||||||
leg.addEvent(legEvent);
|
OrderDetail orderDetail = orderDetailFactory.create(data)
|
||||||
});
|
.price(data.getPrice()).productType(data.getProductType());
|
||||||
|
//为订单添加订单已下单事件
|
||||||
|
OrderEvent orderEvent = orderDetailFactory.createEvent(ORDER_EVENT_PREPARE);
|
||||||
|
orderDetail.addOrderEvent(orderEvent);
|
||||||
|
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.addOrderDetail(orderDetail);
|
||||||
|
leg.addEvent(legEvent);
|
||||||
|
});
|
||||||
|
}
|
||||||
routeRepository.save(routeOrder);
|
routeRepository.save(routeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public interface LegEventService {
|
||||||
//下单事件
|
//下单事件
|
||||||
void orderLeg(LegOrderedCommand command);
|
void orderLeg(LegOrderedCommand command);
|
||||||
|
|
||||||
void routeAddOrder(RouteAddOrderCommand command);
|
void routeUpdateOrder(RouteUpdateOrderCommand command);
|
||||||
|
|
||||||
//付款
|
//付款
|
||||||
void payForLeg(LegPayedCommand command);
|
void payForLeg(LegPayedCommand command);
|
||||||
|
|
|
@ -1,24 +1,10 @@
|
||||||
package com.chint.domain.service.leg_event;
|
package com.chint.domain.service.leg_event;
|
||||||
|
|
||||||
import com.chint.application.commands.*;
|
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.repository.LegRepository;
|
|
||||||
import com.chint.domain.repository.RouteRepository;
|
|
||||||
import com.chint.domain.service.order_sync.SyncAdapter;
|
|
||||||
import com.chint.domain.value_object.ApproveLegData;
|
|
||||||
import com.chint.domain.value_object.OrderLegData;
|
|
||||||
import com.chint.domain.value_object.PayLegData;
|
|
||||||
import com.chint.domain.value_object.SyncLegData;
|
|
||||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||||
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
|
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_APPROVAL;
|
|
||||||
import static com.chint.infrastructure.constant.Constant.ORDER_STATUS_PREPARE;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LegEventServiceImpl implements LegEventService {
|
public class LegEventServiceImpl implements LegEventService {
|
||||||
|
@ -57,10 +43,10 @@ public class LegEventServiceImpl implements LegEventService {
|
||||||
legEventHandler.orderLeg(command);
|
legEventHandler.orderLeg(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ListenTo(command = "RouteAddOrderCommand", order = 0)
|
@ListenTo(command = "RouteUpdateOrderCommand", order = 0)
|
||||||
@Override
|
@Override
|
||||||
public void routeAddOrder(RouteAddOrderCommand command) {
|
public void routeUpdateOrder(RouteUpdateOrderCommand command) {
|
||||||
legEventHandler.routeAddOrder(command);
|
legEventHandler.routeUpdateOrder(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -110,4 +110,31 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
||||||
default -> throw new NotFoundException(NOT_FOUND);
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer translateCarOrderStatus(String carOrderStatus){
|
||||||
|
return switch (carOrderStatus) {
|
||||||
|
case "CreateOrder" -> ORDER_EVENT_PREPARE; //已下单
|
||||||
|
case "WaitReply" -> ORDER_EVENT_ORDERED; //等待应答
|
||||||
|
case "WaitService" -> ORDER_EVENT_ORDERED; //等待接驾
|
||||||
|
case "DriverArrived" -> ORDER_EVENT_ORDERED; //司机就位
|
||||||
|
case "InService" -> ORDER_EVENT_ORDERED; //正在服务
|
||||||
|
case "EndService" -> ORDER_EVENT_PAYED; //行程结束
|
||||||
|
case "Canceling" -> ORDER_EVENT_CANCEL; //取消中
|
||||||
|
case "Canceled" -> ORDER_EVENT_CANCEL; //已取消
|
||||||
|
case "Successful" -> ORDER_EVENT_CANCEL; //已成交
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer translateFlightOrderStatus(String flightOrderStatus){
|
||||||
|
return switch (flightOrderStatus) {
|
||||||
|
case "W" -> ORDER_EVENT_PREPARE; //未处理
|
||||||
|
case "P" -> ORDER_EVENT_ORDERED; //处理中
|
||||||
|
case "C" -> ORDER_EVENT_CANCEL; //已取消
|
||||||
|
case "R" -> ORDER_EVENT_REFUND; //全部退票
|
||||||
|
case "T" -> ORDER_EVENT_REFUND; //部分退票
|
||||||
|
case "S" -> ORDER_EVENT_ORDERED; //已成交
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.chint.domain.service.supplier;
|
package com.chint.domain.service.supplier;
|
||||||
|
|
||||||
import com.chint.application.commands.RouteAddOrderCommand;
|
import com.chint.application.commands.RouteUpdateOrderCommand;
|
||||||
import com.chint.domain.value_object.SupplierCallbackData;
|
import com.chint.domain.value_object.SupplierCallbackData;
|
||||||
import com.chint.infrastructure.echo_framework.command.Command;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -18,6 +18,6 @@ public class SupplierServiceImpl implements SupplierService {
|
||||||
.of(callbackData.getSupplierName())
|
.of(callbackData.getSupplierName())
|
||||||
.adapt(callbackData)
|
.adapt(callbackData)
|
||||||
.ifPresent(data ->
|
.ifPresent(data ->
|
||||||
Command.of(RouteAddOrderCommand.class).data(data).sendToQueue());
|
Command.of(RouteUpdateOrderCommand.class).data(data).sendToQueue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class OrderLegData {
|
||||||
private Integer productType;
|
private Integer productType;
|
||||||
private String price;
|
private String price;
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
|
private String originOrderStatus;
|
||||||
|
|
||||||
private OrderLegData(Builder builder) {
|
private OrderLegData(Builder builder) {
|
||||||
this.actualOrderNo = builder.actualOrderNo;
|
this.actualOrderNo = builder.actualOrderNo;
|
||||||
|
@ -35,6 +36,7 @@ public class OrderLegData {
|
||||||
private Integer productType;
|
private Integer productType;
|
||||||
private String price;
|
private String price;
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
|
private String originOrderStatus;
|
||||||
|
|
||||||
public Builder() {
|
public Builder() {
|
||||||
}
|
}
|
||||||
|
@ -70,6 +72,11 @@ public class OrderLegData {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder originOrderStatus(String originOrderStatus) {
|
||||||
|
this.originOrderStatus = originOrderStatus;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderLegData build() {
|
public OrderLegData build() {
|
||||||
return new OrderLegData(this);
|
return new OrderLegData(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,8 @@ public class Constant {
|
||||||
public static final String ORDER_EVENT_PAYED_NAME = "已预定";
|
public static final String ORDER_EVENT_PAYED_NAME = "已预定";
|
||||||
public static final int ORDER_EVENT_CHANGE = 3;
|
public static final int ORDER_EVENT_CHANGE = 3;
|
||||||
public static final String ORDER_EVENT_CHANGE_NAME = "改签";
|
public static final String ORDER_EVENT_CHANGE_NAME = "改签";
|
||||||
|
public static final int ORDER_EVENT_REFUND = 4;
|
||||||
|
public static final String ORDER_EVENT_REFUND_NAME = "退票";
|
||||||
public static final int ORDER_EVENT_CANCEL = -1;
|
public static final int ORDER_EVENT_CANCEL = -1;
|
||||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.NOT_FOUND;
|
import static com.chint.infrastructure.constant.Constant.NOT_FOUND;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -18,4 +20,9 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
||||||
public OrderDetail findById(Long orderDetailId) {
|
public OrderDetail findById(Long orderDetailId) {
|
||||||
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<OrderDetail> findByOrderNo(String orderNo) {
|
||||||
|
return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,6 @@ import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, Long> {
|
public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, Long> {
|
||||||
|
|
||||||
|
OrderDetail findByOrderNo(String orderNo);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue