Compare commits
No commits in common. "d8151485872dfe1880da3d9a00a55afd996f7c3b" and "55f2ae28dde7cee7f9f9b91115711081a7964e16" have entirely different histories.
d815148587
...
55f2ae28dd
|
@ -2,10 +2,10 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
|
||||
import com.chint.domain.exceptions.LegEventException;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
||||
import com.chint.domain.value_object.LegData;
|
||||
import com.chint.domain.value_object.enums.CurrencyType;
|
||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -100,6 +100,24 @@ public class Leg {
|
|||
|
||||
// Set the legStatus based on the type of the latest event
|
||||
this.legStatus = latestEvent.getEventType();
|
||||
|
||||
// If the latest event is an order event, update the amount
|
||||
if (latestEvent.getEventType() >= LEG_EVENT_ORDERED) {
|
||||
//获取最新的下单事件
|
||||
this.eventList
|
||||
.stream()
|
||||
.filter(legEvent -> legEvent.getEventType().equals(LEG_EVENT_ORDERED))
|
||||
.max(Comparator.comparingLong(LegEvent::getLegEventId))
|
||||
.flatMap(event -> Optional.ofNullable(event.getOrderDetails()))
|
||||
.ifPresent(detail -> {
|
||||
this.amount = detail.stream()
|
||||
.map(OrderDetail::getPrice)
|
||||
.reduce(BigDecimalCalculator::add)
|
||||
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
||||
this.orderDetails = detail;
|
||||
this.currencyType = detail.get(0).getCurrencyType();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.legStatusName = translateLegStatus(this.legStatus);
|
||||
|
@ -111,8 +129,6 @@ public class Leg {
|
|||
if (this.getLegExtensionField() != null && this.getLegExtensionField().getAmountType() != null) {
|
||||
this.getLegExtensionField().reloadStatus();
|
||||
}
|
||||
|
||||
//
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -189,12 +205,12 @@ public class Leg {
|
|||
return this;
|
||||
}
|
||||
|
||||
// 如果列表不为空,确保新事件的类型是按顺序的、与最后一个事件类型相同或者浮动为1
|
||||
// 如果列表不为空,确保新事件的类型是按顺序的或者与最后一个事件类型相同
|
||||
if (!eventList.isEmpty()) {
|
||||
LegEvent lastEvent = eventList.get(eventList.size() - 1);
|
||||
int lastEventType = lastEvent.getEventType();
|
||||
if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 1) {
|
||||
throw new LegEventException("New event must be the same as, immediately before, or immediately after the last event type.");
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +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.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -26,8 +27,8 @@ public class LegEvent {
|
|||
|
||||
private LocalDateTime happenTime;
|
||||
|
||||
@Transient
|
||||
private List<OrderDetail> orderDetailIds;
|
||||
@MappedCollection(idColumn = "leg_event_id",keyColumn = "leg_event_key")
|
||||
private List<OrderDetail> orderDetails;
|
||||
|
||||
public String translateLegEvent(int event) {
|
||||
return switch (event) {
|
||||
|
@ -46,4 +47,12 @@ public class LegEvent {
|
|||
this.setEventName(translateLegEvent(this.eventType));
|
||||
return this;
|
||||
}
|
||||
|
||||
public LegEvent addOrderDetail(OrderDetail orderDetail){
|
||||
if(this.orderDetails == null){
|
||||
this.orderDetails = new ArrayList<>();
|
||||
}
|
||||
this.orderDetails.add(orderDetail);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import static com.chint.infrastructure.constant.Constant.ORDER_EVENT_UNKNOWN;
|
|||
public class OrderDetail {
|
||||
@Id
|
||||
private Long orderId; // 使用 order_id 作为主键
|
||||
private Long legId; // 使用行程节点关联leg
|
||||
private String orderNo;
|
||||
private String supplierName;
|
||||
private Integer productType; // 商品类型
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.chint.domain.aggregates.order;
|
||||
|
||||
|
||||
import com.chint.application.commands.LegOrderedCommand;
|
||||
import com.chint.domain.aggregates.base.BaseEntity;
|
||||
import com.chint.domain.factoriy.leg.LegFactory;
|
||||
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
||||
import com.chint.domain.value_object.LegData;
|
||||
import com.chint.domain.value_object.OrderSaveData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
@ -339,21 +337,4 @@ public class RouteOrder extends BaseEntity {
|
|||
default -> "未知供应商";
|
||||
};
|
||||
}
|
||||
|
||||
public void matchOrderWithLeg(OrderDetail orderDetail) {
|
||||
if (this.legItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.legItems.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 -> Command.of(LegOrderedCommand.class)
|
||||
.legId(leg.getLegId())
|
||||
.orderDetailId(orderDetail.getOrderId())
|
||||
.sendToQueue());
|
||||
}
|
||||
}
|
|
@ -13,9 +13,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
@Override
|
||||
public OrderDetail create(OrderLegData orderLegData) {
|
||||
OrderDetail orderDetail = OrderDetail.of(orderLegData.getOutOrderNo(), orderLegData.getSupplierName());
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd mm-hh-ss");
|
||||
orderDetail.setStartTime(LocalDateTime.parse(orderLegData.getStartTime(), dateTimeFormatter));
|
||||
orderDetail.setEndTime(LocalDateTime.parse(orderLegData.getEndTime(), dateTimeFormatter));
|
||||
orderDetail.setEndTime(LocalDateTime.parse(orderLegData.getEndTime()));
|
||||
orderDetail.setOrderDate(LocalDateTime.parse(orderLegData.getOrderTime(), dateTimeFormatter));
|
||||
orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
|
||||
orderDetail.setDestinationId(orderLegData.getDestinationId());
|
||||
|
|
|
@ -2,14 +2,11 @@ package com.chint.domain.repository;
|
|||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface OrderDetailRepository {
|
||||
OrderDetail findById(Long orderDetailId);
|
||||
|
||||
List<OrderDetail> findByLegId(Long legId);
|
||||
|
||||
Optional<OrderDetail> findByOrderNo(String orderNo);
|
||||
|
||||
OrderDetail save(OrderDetail orderDetail);
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.chint.domain.service;
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.LegEvent;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||
import com.chint.domain.repository.LegRepository;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.*;
|
||||
|
||||
@Service
|
||||
public class LegDomainService {
|
||||
@Autowired
|
||||
private OrderDetailRepository orderDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private LegRepository legRepository;
|
||||
|
||||
@Autowired
|
||||
private LegEventFactory legEventFactory;
|
||||
|
||||
public Leg legCheckOrder(Leg leg) {
|
||||
List<OrderDetail> orderDetailList = orderDetailRepository.findByLegId(leg.getLegId());
|
||||
orderDetailList.forEach(OrderDetail::reloadStatus);
|
||||
orderDetailList = orderDetailList.stream().filter(orderDetail ->
|
||||
List.of(ORDER_EVENT_ORDERED, ORDER_EVENT_PAYED, ORDER_EVENT_CHANGE, ORDER_EVENT_FINISH)
|
||||
.contains(orderDetail.getOrderStatus())
|
||||
).toList();
|
||||
leg.setOrderDetails(orderDetailList);
|
||||
//如果发现行程节点的状态和订单不匹配 , 那需要进行事件更新
|
||||
if (!orderDetailList.isEmpty() && leg.getLegStatus() < LEG_EVENT_ORDERED) {
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(LEG_EVENT_ORDERED);
|
||||
leg.addEvent(legEvent);
|
||||
}
|
||||
if (orderDetailList.isEmpty() && leg.getLegStatus() >= LEG_EVENT_ORDERED) {
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(LEG_EVENT_NOT_ORDERED);
|
||||
leg.addEvent(legEvent);
|
||||
}
|
||||
return legRepository.save(leg);
|
||||
}
|
||||
}
|
|
@ -100,8 +100,4 @@ public class OrderDomainService {
|
|||
|
||||
//这里如果发现事件的状态为Approving2 , 需要根据发送审批给bpm,需要先查询订单数据
|
||||
}
|
||||
|
||||
public void legAutoAddOrder(){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.chint.application.commands.*;
|
|||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.CommandException;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.exceptions.OrderException;
|
||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||
|
@ -14,17 +13,12 @@ import com.chint.domain.repository.OrderDetailRepository;
|
|||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.order_sync.SyncAdapter;
|
||||
import com.chint.domain.value_object.ApprovalLegData;
|
||||
import com.chint.domain.value_object.ApproveLegData;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
import com.chint.domain.value_object.SyncLegData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.*;
|
||||
|
@ -119,13 +113,9 @@ public class LegEventHandler implements LegEventService {
|
|||
if (!syncAdapter.of(supplierName).syncSupplierOrder(routeOrder)) {
|
||||
throw new CommandException("订单提交失败");
|
||||
}
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
} else {
|
||||
throw new CommandException("订单未提交审批");
|
||||
}
|
||||
if (routeOrder.getOrderStatus() > (ORDER_STATUS_APPROVAL)) {
|
||||
throw new CommandException("订单已同步");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -143,21 +133,39 @@ public class LegEventHandler implements LegEventService {
|
|||
.stream()
|
||||
.filter(orderDetail -> orderDetail.getOrderNo().equals(data.getOutOrderNo()))
|
||||
.findFirst();
|
||||
if (byOrderNo.isEmpty()) {
|
||||
if (byOrderNo.isEmpty())
|
||||
// {
|
||||
// //如果订单以及存在了,对订单的状态进行更新,
|
||||
// OrderEvent event = orderDetailFactory.createEvent(data.getOrderStatus(), data.getOriginOrderStatus());
|
||||
// OrderDetail orderDetail = byOrderNo.get();
|
||||
// orderDetail.addOrderEvent(event);
|
||||
// } else
|
||||
{
|
||||
//否则创建新的订单添加到routeOrder
|
||||
OrderDetail orderDetail = orderDetailFactory.create(data)
|
||||
|
||||
.price(data.getPrice()).productType(data.getProductType());
|
||||
|
||||
//为订单添加订单已下单事件
|
||||
// OrderEvent orderEvent = orderDetailFactory.createEvent(ORDER_EVENT_PREPARE, data.getOriginOrderStatus());
|
||||
// orderDetail.addOrderEvent(orderEvent);
|
||||
routeOrder.addOrderDetail(orderDetail);
|
||||
//结合外部订单信息,筛选最合适的leg节点 ,触发下单事件; 这里另外发送一个命令用于处理leg和orderDetail之间的关系
|
||||
}
|
||||
routeOrder = routeRepository.save(routeOrder);
|
||||
OrderDetail orderDetail = routeOrder
|
||||
.getOrderDetails()
|
||||
//结合外部订单信息,筛选最合适的leg节点 ,触发下单事件 ;
|
||||
routeOrder.getLegItems()
|
||||
.stream()
|
||||
.max(Comparator.comparing(OrderDetail::getCreateTime))
|
||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理
|
||||
routeOrder.matchOrderWithLeg(orderDetail);
|
||||
.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);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -165,22 +173,25 @@ public class LegEventHandler implements LegEventService {
|
|||
public void orderLeg(LegOrderedCommand command) {
|
||||
//如果筛选事件可能会是错误,需要用户手动添加并修改事件 , 因此会进行额外出发修改下单事件。
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
|
||||
//因为orderDetail已经进行持久化保存 ,只需要从数据库进行查询
|
||||
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
|
||||
LegEvent legEvent = legEventFactory
|
||||
.creatLegEvent(command.getLegEventType());
|
||||
.creatLegEvent(command.getLegEventType())
|
||||
.addOrderDetail(orderDetail);
|
||||
leg.addEvent(legEvent);
|
||||
orderDetail.setLegId(leg.getLegId());
|
||||
|
||||
legRepository.save(leg);
|
||||
orderDetailRepository.save(orderDetail);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void payForLeg(LegPayedCommand command) {
|
||||
// PayLegData data = command.getData();
|
||||
PayLegData data = command.getData();
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
legEvent.addOrderDetail(orderDetail);
|
||||
leg.addEvent(legEvent);
|
||||
legRepository.save(leg);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ 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.LocationRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
|
@ -30,9 +29,6 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
@Autowired
|
||||
private OrderDomainService orderDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public boolean syncSupplierOrder(RouteOrder order) {
|
||||
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址
|
||||
|
@ -90,54 +86,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
//作废状态2
|
||||
order.setStatus(2);
|
||||
System.out.println("开始取消同程订单");
|
||||
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址
|
||||
//1.设置订单参数
|
||||
SupplierOrderParam param = new SupplierOrderParam();//参数
|
||||
param.setOutEmployeeIdType(0);//外部员工ID类型,默认为0
|
||||
// param.setOutTravelApplyNo(order.getApproveOrderNo().getActualOrderNo());//审批订单号
|
||||
param.setOutTravelApplyNo(order.getRouteOrderNo());//审批订单号
|
||||
param.setTravelApplyType(1); //差旅类型:1 普通差旅,2 福利差旅
|
||||
param.setStatus(order.getStatus());//状态:1通过,2作废
|
||||
//日期格式化
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
String applyTime = order.getCreateTime().format(formatter);
|
||||
String updateTime = order.getUpdateTime().format(formatter);
|
||||
param.setTravelApplyTime(applyTime);//开始(创建)时间
|
||||
param.setTravelUpdateTime(updateTime);//最后更新时间
|
||||
param.setOperationType(1);//1新增,2更新
|
||||
//获取用户信息
|
||||
// User user = BaseContext.getCurrentUser();
|
||||
User user = userRepository.findByUserEmployeeNo(order.getUserId());
|
||||
param.setOutEmployeeId(String.valueOf(order.getUserId()));//用户id
|
||||
param.setTravelDescription("同程订单");//描述信息
|
||||
param.setBookableProducts("1,3,5");//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
||||
//2.同程的行程节点集合
|
||||
List<AOSItem> aosItems = getAosItems(order);
|
||||
//3.差旅人信息
|
||||
List<AOSPerson> aosPeople = new ArrayList<>();
|
||||
AOSPerson aosPerson = new AOSPerson();
|
||||
aosPerson.setName(user.getName());//用户名
|
||||
aosPerson.setRelation(0);//0:内部员工,1:配偶,2:子女,3:父母,4:面试候选人,5:实习生,6:外部宾客
|
||||
aosPerson.setPassengerType(0);//0:成人, 1:儿童, 2:婴儿
|
||||
aosPerson.setOutEmployeeId(String.valueOf(order.getUserId()));//SF号(长工号)
|
||||
aosPeople.add(aosPerson);
|
||||
//4.前置差旅政策
|
||||
List<AOSPreTravelPolicy> aosPreTravelPolicies = new ArrayList<>();
|
||||
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
|
||||
aosPreTravelPolicy.setPolicyCode("");//一般指客户经理提供的差旅政策标题
|
||||
aosPreTravelPolicy.setProductTypeId(0);//产品ID 1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
||||
aosPreTravelPolicies.add(aosPreTravelPolicy);
|
||||
|
||||
param.setItemList(aosItems); // 同程节点内容
|
||||
param.setPersonList(aosPeople);// 同程信息(实际出行人)
|
||||
param.setPreTravelPolicyList(aosPreTravelPolicies);// 同程政策
|
||||
param.setApproveRuleType(0);//审批规则
|
||||
SupplierOrderSyncDto supplierOrderSyncDto = new SupplierOrderSyncDto();
|
||||
supplierOrderSyncDto.setParam(param);
|
||||
Result result = postRequest.post(supplierOrderSyncUrl, supplierOrderSyncDto, Result.class);
|
||||
System.out.println("result = " + result);
|
||||
String success = result.getSuccess();
|
||||
return Boolean.parseBoolean(success);
|
||||
return syncSupplierOrder(order);
|
||||
}
|
||||
|
||||
//同程Leg集合解析
|
||||
|
|
|
@ -111,11 +111,9 @@ public class Constant {
|
|||
public static final String LEG_OTHER_AMOUNT_BUS_EN_NAME = "CoachBus";
|
||||
|
||||
//同程订单数据回推类型
|
||||
public static final int PRODUCT_TYPE_TRAIN = 5; //火车
|
||||
public static final int PRODUCT_TYPE_TRAIN = 0; //火车
|
||||
public static final int PRODUCT_TYPE_FLY = 1; //飞机
|
||||
public static final int PRODUCT_TYPE_COMMON = 0; //通用推送
|
||||
public static final int PRODUCT_TYPE_CHAILORDER = 4; //差旅单推送
|
||||
public static final int PRODUCT_TYPE_TRAIN_CAR = 6; //用车
|
||||
public static final int PRODUCT_TYPE_TRAIN_CAR = 2; //用车
|
||||
public static final int PRODUCT_TYPE_TRAIN_HOTEL = 3; //酒店
|
||||
|
||||
// 规划节点事件
|
||||
|
@ -144,9 +142,9 @@ public class Constant {
|
|||
public static final int ORDER_EVENT_CHANGE = 3;
|
||||
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_FINISH = 5;
|
||||
public static final String ORDER_EVENT_FINISH_NAME = "已完成";
|
||||
public static final String ORDER_EVENT_REFUND_NAME = "退票";
|
||||
public static final int ORDER_EVENT_CANCEL = -1;
|
||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||
public static final int ORDER_EVENT_UNKNOWN = -99;
|
||||
|
@ -233,7 +231,6 @@ public class Constant {
|
|||
|
||||
//同程
|
||||
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
||||
public static final String L_Y_STROKE_PUSH = "/api/TravelBizOrder/ExternalApproval";//行程推送外部审批
|
||||
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";
|
||||
|
@ -293,7 +290,4 @@ public class Constant {
|
|||
public static final String STANDARD_LEVEL_THREE = "STANDARD_LEVEL_THREE";//方法名称
|
||||
public static final String STANDARD_LEVEL_FOUR = "STANDARD_LEVEL_FOUR";//方法名称
|
||||
|
||||
|
||||
//BPM
|
||||
public static final String EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.infrastructure.echo_framework.manager;
|
||||
|
||||
|
||||
import com.chint.domain.service.leg_event.LegEventService;
|
||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
|
@ -17,7 +18,9 @@ import org.springframework.context.ApplicationContextAware;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
import com.chint.domain.service.leg_event.LegEventServiceImpl;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
@ -84,17 +87,14 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini
|
|||
List<MethodContainer> containers = listenerMethods.getOrDefault(command.getCommandName(), Collections.emptyList());
|
||||
List<ResultContainer> resultContainers = new ArrayList<>();
|
||||
containers.forEach(container -> {
|
||||
|
||||
Object result = null;
|
||||
try {
|
||||
result = container.getMethod().invoke(container.getBean(), command);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object result = container.getMethod().invoke(container.getBean(), command);
|
||||
if (result instanceof ResultContainer) {
|
||||
resultContainers.add((ResultContainer) result);
|
||||
}
|
||||
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace(); // Handle exceptions appropriately
|
||||
}
|
||||
});
|
||||
return resultContainers;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
|
@ -37,23 +37,4 @@ public class GlobalExceptionHandler {
|
|||
public Result<String> handleDuplicateException(HttpServletRequest request, DuplicateException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public Result<String> handleException(Exception ex) {
|
||||
Throwable rootCause = ex;
|
||||
// 检查是否是通过反射调用抛出的异常
|
||||
Throwable cause = rootCause.getCause();
|
||||
while (rootCause instanceof InvocationTargetException && cause != null) {
|
||||
rootCause = cause;
|
||||
}
|
||||
return Result.error(cause.getCause().getMessage());
|
||||
// // 根据不同的异常类型进行处理
|
||||
// if (rootCause instanceof CommandException) {
|
||||
// // 特定异常的处理逻辑
|
||||
// return new ResponseEntity<>("订单未提交审批", HttpStatus.BAD_REQUEST);
|
||||
// } else {
|
||||
// // 其他异常的处理逻辑
|
||||
// return new ResponseEntity<>("内部服务器错误", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.NOT_FOUND;
|
||||
|
@ -22,11 +21,6 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
|||
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderDetail> findByLegId(Long legId) {
|
||||
return orderDetailRepository.findByLegId(legId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<OrderDetail> findByOrderNo(String orderNo) {
|
||||
return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo));
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.location.CityEntity;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcCityRepository extends CrudRepository<CityEntity,Long> {
|
||||
CityEntity findByCityName(String cityName);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,12 +4,8 @@ import com.chint.domain.aggregates.order.OrderDetail;
|
|||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, Long> {
|
||||
|
||||
OrderDetail findByOrderNo(String orderNo);
|
||||
|
||||
List<OrderDetail> findByLegId(Long legId);
|
||||
}
|
||||
|
|
|
@ -10,5 +10,4 @@ import java.util.List;
|
|||
public interface JdbcRanksRepository extends CrudRepository<Ranks, Integer> {
|
||||
Ranks findByCompanyCodeAndRankName(String companyCode, String rankName);
|
||||
List<Ranks> findByCompanyCode(String companyCode);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,5 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
@NoArgsConstructor
|
||||
public class CTripNoteResponse {
|
||||
private String errorCode;
|
||||
|
||||
private String errorMessage;
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly;
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.EXCEED_STANDARD_URL;
|
||||
|
||||
|
||||
@Service
|
||||
public class BPMRequest {
|
||||
|
||||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
//超标申请
|
||||
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
|
||||
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
|
||||
}
|
||||
|
||||
//改签
|
||||
public BPMResponse reschedule(RescheduleDto rescheduleDto) {
|
||||
return submitWorkflow("JT_FI_CLGQSQ", rescheduleDto);
|
||||
}
|
||||
|
||||
public BPMResponse submitWorkflow(String workflowCode, Object entityObject) {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
Gson gson = new Gson();
|
||||
String entityParamValues = gson.toJson(entityObject);
|
||||
//获取用户信息
|
||||
User user = BaseContext.getCurrentUser();
|
||||
bpmRequest.setWorkflowCode(workflowCode)
|
||||
.setUserCode(String.valueOf(user.getEmployeeNo()))//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(EXCEED_STANDARD_URL, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LYNoteResponse {
|
||||
private String resCode;
|
||||
private String resMsg;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Notification {
|
||||
public Object notifyData;
|
||||
public int notifyType; //推送类型
|
||||
public int subNotifyType; //推送子类型
|
||||
public long notifyTime; //推送时间戳
|
||||
public String sign; //推送签名
|
||||
public String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BPMBaseRequest {
|
||||
private String workflowCode;//流程编码
|
||||
private String userCode;//发起人SF号
|
||||
private Boolean finishStart;//是否结果填单节点
|
||||
private String EntityParamValues;//数据
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BPMResponse {
|
||||
private Boolean Success;//创建成功标志
|
||||
private String InstanceID;//实例id
|
||||
private String Message;//返回消息
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 超标
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ExceedStandardDto {
|
||||
|
||||
private String OrderType; //订单类型 是否必填:是 内容选项:酒店超标,火车票超标,机票超标
|
||||
private String OrderSource; //订单来源 是否必填:是 携程商旅/同程商旅
|
||||
private String OrderNo; //订单号 是否必填:是
|
||||
private String HotelStandard; //住宿标准 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String HotelName; //酒店名称 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String HouseLayout; //房型 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String SeatingStandard; //席别标准 是否必填:否 当订单类型=火车票超标 时需提供
|
||||
private String CabinClass; //舱等 是否必填:否 当订单类型=机票超标 时需提供
|
||||
private BigDecimal ExcessAmount;//超标金额 是否必填:是
|
||||
private String Reason; //超标原因 是否必填:否
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 改签
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RescheduleDto {
|
||||
private String OrderType;//订单类型 是否必填:是
|
||||
private String OrderSource;//订单来源 是否必填:是
|
||||
private String OrderNo;//订单号 是否必填:是
|
||||
private String StartTime;//原时间 是否必填:否 机票改签或火车票改签提供。
|
||||
private String RebookStartTime;//改签后时间 是否必填:否 机票改签或火车票改签提供
|
||||
private String TrainNumber;//原车次 是否必填:否 火车票改签提供
|
||||
private String SeatingStandard;//原席别 是否必填:否 火车票改签提供
|
||||
private String RebookTrainNumber;//改签后车次 是否必填:否 火车票改签提供
|
||||
private String RebookSeatingStandard;//改签后席别 是否必填:否 火车票改签提供
|
||||
private BigDecimal Fee;//费用 是否必填:是
|
||||
private String Reason;//原因 是否必填:否
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.chint.interfaces.rest.ly.dto.carorderdatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -9,6 +8,11 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationCar extends Notification {
|
||||
public class Notification {
|
||||
private NotifyData notifyData;
|
||||
private int notifyType; //推送类型
|
||||
private int subNotifyType; //推送子类型
|
||||
private long notifyTime; //推送时间戳
|
||||
private String sign; //推送签名
|
||||
private String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -4,8 +4,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
|
@ -14,7 +12,4 @@ public class NotifyData {
|
|||
private OrderDriver orderDriver;
|
||||
private OrderExtend orderExtend;
|
||||
private TravelData travelData;
|
||||
private List<PriceDetail> priceDetailList;
|
||||
private List<SubmitItem> submitItemList;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.chint.interfaces.rest.ly.dto.flydatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Notification {
|
||||
private OrderDetails orderDetails;
|
||||
private int notifyType; //推送类型
|
||||
private int subNotifyType; //推送子类型
|
||||
private long notifyTime; //推送时间戳
|
||||
private String sign; //推送签名
|
||||
private String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.flydatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationFly extends Notification{
|
||||
private OrderDetails orderDetails;
|
||||
}
|
|
@ -48,9 +48,6 @@ public class OrderDetails {
|
|||
private Integer refId;
|
||||
private boolean ruleViolate;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
private TravelData travelData;
|
||||
private List<Passenger> passengerList;
|
||||
private List<FlightSegment> flightSegmentList;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Notification {
|
||||
private OrderInfo orderInfo;
|
||||
private int notifyType; //推送类型
|
||||
private int subNotifyType; //推送子类型
|
||||
private long notifyTime; //推送时间戳
|
||||
private String sign; //推送签名
|
||||
private String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationHotel extends Notification {
|
||||
private OrderInfo orderInfo;
|
||||
}
|
|
@ -47,14 +47,6 @@ public class OrderInfo {
|
|||
private String supplierOrderCreateTime;
|
||||
private boolean ruleViolate;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
private HotelInfo hotelInfo;
|
||||
private DayPrice dayPrice;
|
||||
private List<String> residents;
|
||||
private List<Resident> residentList;
|
||||
private ContactPerson contactPerson;
|
||||
private RefundInfo refundInfo;
|
||||
private TravelData travelData;
|
||||
private List<RoomList> roomList;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.strokepush;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Param {
|
||||
private String travelBizOrderNo;
|
||||
private Integer remarks;
|
||||
private Integer approvalStatus;
|
||||
private Integer externalApprovalNo;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.strokepush;
|
||||
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.L_Y_BASE_URL;
|
||||
import static com.chint.infrastructure.constant.Constant.L_Y_STROKE_PUSH;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/public/stroke")
|
||||
public class StrokeController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PostRequest postRequest;
|
||||
|
||||
private String strokeUrl = L_Y_BASE_URL + L_Y_STROKE_PUSH;
|
||||
|
||||
@PostMapping("/push")
|
||||
public Integer strokePush(@RequestBody StrokePushDTO strokePushDTO){
|
||||
Integer status = strokePushDTO.getParam().getApprovalStatus();
|
||||
if (status == 1 || status == 2){
|
||||
StrokePushResult postData = postRequest.post(strokeUrl, strokePushDTO.getParam(), StrokePushResult.class);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.strokepush;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.LYBaseRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StrokePushDTO extends LYBaseRequest {
|
||||
private Param param;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.strokepush;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StrokePushResult {
|
||||
private Boolean success;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
private String data;
|
||||
private String errorType;
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.chint.interfaces.rest.ly.dto.ticketpush;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Notification {
|
||||
private NotifyData notifyData;
|
||||
private int notifyType; //推送类型
|
||||
private int subNotifyType; //推送子类型
|
||||
private long notifyTime; //推送时间戳
|
||||
private String sign; //推送签名
|
||||
private String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationTrain extends Notification {
|
||||
private NotifyData notifyData;
|
||||
}
|
|
@ -4,47 +4,17 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotifyData {
|
||||
private String orderNo;
|
||||
private String outOrderNo;
|
||||
private String issueTime;
|
||||
private String msgCode;
|
||||
private String msgInfo;
|
||||
private String fromStationCode;
|
||||
private String toStationCode;
|
||||
private String departureTime;
|
||||
private String arrivalTime;
|
||||
private String trainNo;
|
||||
private String ticketNo;
|
||||
private String orderAmount;
|
||||
private String fromStation;
|
||||
private String toStation;
|
||||
private String issueTime;
|
||||
private String mailCharge;
|
||||
private String msgDetail;
|
||||
private String ticketGate;
|
||||
private List<Passenger> passengers;
|
||||
private boolean isSelfToProxy;
|
||||
private String isChangedOrder;
|
||||
private String fInfo;
|
||||
private String originalOrderNo;
|
||||
private String changedType;
|
||||
private String serviceCharge;
|
||||
private String changePriceDiff;
|
||||
private String expirationTime;
|
||||
private String directPayInfo;
|
||||
private int waitFlag;
|
||||
private int payType;
|
||||
private int isNeedTransfer;
|
||||
private String outEmployeeId;
|
||||
private String outEnterpriseId;
|
||||
private int bookingMethod;
|
||||
private boolean ruleViolate;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
private TravelData travelData;
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class Passenger {
|
||||
private String passengerName;
|
||||
private String passengerType;
|
||||
private String cardType;
|
||||
private String cardNo;
|
||||
private Integer itemId;
|
||||
private String seatClass;
|
||||
private String seatNo;
|
||||
private String price;
|
||||
private String pTicketNo;
|
||||
private String serviceCharge;
|
||||
private String insuranceCharge;
|
||||
private String oldPassengerId;
|
||||
private String outEmployeeId;
|
||||
|
||||
// Getters and Setters...
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class RuleViolateDetail {
|
||||
private String policyName;
|
||||
private List<Object> items;
|
||||
|
||||
// Getters and Setters...
|
||||
}
|
|
@ -4,11 +4,13 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.NotificationCar;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -32,9 +34,8 @@ public class CarBackController {
|
|||
|
||||
|
||||
@PostMapping("/back")
|
||||
|
||||
public LYNoteResponse carBack(@RequestBody NotificationCar notificationCar) {
|
||||
String orderSerialNo = notificationCar.getNotifyData().getOrderSerialNo();
|
||||
public CTripNoteResponse carBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderSerialNo);
|
||||
String outEmployeeId = carDetailResponse.getData().getOutEmployeeId(); //外部员工id
|
||||
|
@ -47,13 +48,13 @@ public class CarBackController {
|
|||
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notificationCar.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
|
||||
command.eventType(carStatus(notificationCar.getSubNotifyType()));
|
||||
command.eventType(carStatus(notification.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
}
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
}
|
||||
public Integer carStatus(Integer status) {
|
||||
return switch (status) {
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package com.chint.interfaces.rest.ly.in;
|
||||
|
||||
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.NotificationCar;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.NotificationFly;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.NotificationHotel;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.NotificationTrain;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/public/common")
|
||||
public class CommonController {
|
||||
|
||||
@Autowired
|
||||
private CarBackController carBackController;
|
||||
|
||||
@Autowired
|
||||
private FlyBackController flyBackController;
|
||||
|
||||
@Autowired
|
||||
private HotelBackController hotelBackController;
|
||||
|
||||
@Autowired
|
||||
private TrainBackController trainBackController;
|
||||
@PostMapping("/back")
|
||||
public LYNoteResponse hotelBack(@RequestBody Notification notification) {
|
||||
int notifyType = notification.getNotifyType();
|
||||
return switch (notifyType){
|
||||
case 1 -> flyBackController.ticketBack((NotificationFly) notification);
|
||||
case 3 -> hotelBackController.hotelBack((NotificationHotel) notification);
|
||||
case 5 -> trainBackController.trainBack((NotificationTrain) notification);
|
||||
case 6-> carBackController.carBack((NotificationCar) notification);
|
||||
default -> new LYNoteResponse("200", "失败");
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -4,10 +4,12 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.NotificationFly;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -33,8 +35,8 @@ public class FlyBackController {
|
|||
|
||||
//机票订单数据回推
|
||||
@PostMapping("/back")
|
||||
public LYNoteResponse ticketBack(@RequestBody NotificationFly notificationFly) {
|
||||
String orderSerialNo = notificationFly.getOrderDetails().getOrderSerialNo();
|
||||
public CTripNoteResponse ticketBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getOrderDetails().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
FlightOrderDetail flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = flightOrderDetail.getData().getOrderDetails().getOutEmployeeId();//外部员工id
|
||||
|
@ -46,12 +48,12 @@ public class FlyBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notificationFly.getSubNotifyType()));
|
||||
command.eventType(mapFlightStatus(notificationFly.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
command.eventType(mapFlightStatus(notification.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
}
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
}
|
||||
|
||||
public Integer mapFlightStatus(Integer status) {
|
||||
|
|
|
@ -6,10 +6,11 @@ import com.chint.domain.value_object.SupplierCallbackData;
|
|||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.NotificationHotel;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -31,12 +32,14 @@ public class HotelBackController {
|
|||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
|
||||
@PostMapping("/back")
|
||||
public LYNoteResponse hotelBack(@RequestBody NotificationHotel notificationHotel) {
|
||||
public CTripNoteResponse hotelBack(@RequestBody Notification notification) {
|
||||
|
||||
String orderSerialNo = notificationHotel.getOrderInfo().getOrderSerialNo();
|
||||
String orderSerialNo = notification.getOrderInfo().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = hotelOrderDetail.getData().getOrderInfo().getOutEmployeeId();//外部员工id
|
||||
|
@ -49,13 +52,13 @@ public class HotelBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notificationHotel.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
//状态映射
|
||||
command.eventType(mapHotelState(notificationHotel.getSubNotifyType()));
|
||||
command.eventType(mapHotelState(notification.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
}
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.NotificationTrain;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.Notification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -31,8 +32,8 @@ public class TrainBackController {
|
|||
private SupplierService supplierService;
|
||||
|
||||
@PostMapping("/back")
|
||||
public LYNoteResponse trainBack(@RequestBody NotificationTrain notificationTrain) {
|
||||
String orderSerialNo = notificationTrain.getNotifyData().getOrderNo();
|
||||
public CTripNoteResponse trainBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = trainOrderDetail.getData().getOutEmployeeId();//外部员工id
|
||||
|
@ -44,13 +45,13 @@ public class TrainBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notificationTrain.getSubNotifyType()));
|
||||
command.eventType(mapTrainState(notificationTrain.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
command.eventType(mapTrainState(notification.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
}
|
||||
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
}
|
||||
public Integer mapTrainState(Integer status) {
|
||||
return switch (status) {
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.chint;
|
|||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.CityRepository;
|
||||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ctrip.*;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
|
||||
|
@ -24,8 +22,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.SUPPLIER_C_TRIP;
|
||||
|
||||
@SpringBootTest
|
||||
public class CTripTest {
|
||||
|
||||
|
@ -47,9 +43,6 @@ public class CTripTest {
|
|||
@Autowired
|
||||
private CTripLoginRequest loginRequest;
|
||||
|
||||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
|
||||
//@Test
|
||||
|
@ -148,14 +141,4 @@ public class CTripTest {
|
|||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30469349853");
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchAndHandlerData(){
|
||||
BaseContext.setCurrentUser(user);
|
||||
SupplierCallbackData supplierCallbackData =
|
||||
SupplierCallbackData.of(SUPPLIER_C_TRIP);
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30544187403");
|
||||
supplierCallbackData.data(response);
|
||||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,25 +4,16 @@ import com.chint.domain.aggregates.base.BaseEntity;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.constant.Constant;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYLoginRequest;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYTokenRequest;
|
||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
||||
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.HotelListVo;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -52,9 +43,6 @@ public class LYTest {
|
|||
@Autowired
|
||||
private LYLoginRequest loginRequest;
|
||||
|
||||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
||||
|
||||
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync";
|
||||
|
@ -74,9 +62,6 @@ public class LYTest {
|
|||
private final String minPriceUrl = L_Y_BASE_URL + L_Y_HOTLE_MIN_PRICE_PATH;
|
||||
private final String hotleListUrl = L_Y_BASE_URL + L_Y_HOTLE_LIST_PATH;
|
||||
|
||||
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
|
||||
|
||||
|
@ -141,7 +126,7 @@ public class LYTest {
|
|||
System.out.println(max);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
//外部差旅单同步
|
||||
void ApplyOrderSync() {
|
||||
AOSParam aosParam = new AOSParam();
|
||||
|
@ -277,79 +262,29 @@ public class LYTest {
|
|||
System.out.println(post);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void loadToken() {
|
||||
System.out.println(lyTokenRequest.loadToken());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void saveCurrentUser2Ly() {
|
||||
// BaseContext.setCurrentUser(user);
|
||||
BaseContext.setCurrentUser(hxh);
|
||||
System.out.println(lyUserRequest.saveCurrentUser());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void loginLY() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void loginLYPC() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
||||
}
|
||||
|
||||
//超标
|
||||
@Test
|
||||
void exceedStandard() {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
Gson gson = new Gson();
|
||||
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||
exceedStandardDto.setOrderType("酒店超标")//内容选项:酒店超标,火车票超标,机票超标
|
||||
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
|
||||
.setOrderNo("00002")//订单号
|
||||
.setHotelStandard("标间")//酒店超标提供:住宿标准
|
||||
.setHotelName("酒店名称")//酒店超标提供:酒店名称
|
||||
.setHouseLayout("双人床")//酒店超标提供:房型
|
||||
.setSeatingStandard("")//火车票超标提供:席别标准
|
||||
.setCabinClass("")//:机票超标提供:舱等
|
||||
.setExcessAmount(BigDecimal.valueOf(100))//超标金额
|
||||
.setReason("酒店爆满订不到");//超标原因
|
||||
String entityParamValues = gson.toJson(exceedStandardDto);
|
||||
bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码
|
||||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
}
|
||||
|
||||
//改签
|
||||
@Test
|
||||
void reschedule() {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
Gson gson = new Gson();
|
||||
RescheduleDto rescheduleDto = new RescheduleDto();
|
||||
rescheduleDto.setOrderType("机票改签")//内容选项:机票改签,机票退票,火车票改签,火车票退票
|
||||
.setOrderSource("携程商旅")//携程商旅/同程商旅
|
||||
.setOrderNo("00002")//订单号
|
||||
.setStartTime("2024-02-22 10:00:00")//机票改签或火车票改签提供: 原时间
|
||||
.setRebookStartTime("2024-02-23 10:00:00")//机票改签或火车票改签提供: 改签后时间
|
||||
.setTrainNumber("")//火车票改签提供: 原车次
|
||||
.setSeatingStandard("")//火车票改签提供: 原席别
|
||||
.setRebookTrainNumber("")//火车票改签提供: 改签后车次
|
||||
.setRebookSeatingStandard("")//火车票改签提供: 改签后席别
|
||||
.setFee(BigDecimal.valueOf(100))//费用
|
||||
.setReason("行程冲突");//原因
|
||||
String entityParamValues = gson.toJson(rescheduleDto);
|
||||
bpmRequest.setWorkflowCode("JT_FI_CLGQSQ")//流程编码
|
||||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
|
@ -36,13 +34,6 @@ class RouteApplicationTests {
|
|||
userHttpRequest.loadUserInfo(user);
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
void dataParse(){
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter);
|
||||
System.out.println(parse);
|
||||
}
|
||||
@Test
|
||||
void loginSign() {
|
||||
String sfno = "230615020";
|
||||
|
|
Loading…
Reference in New Issue