Compare commits

..

No commits in common. "d8151485872dfe1880da3d9a00a55afd996f7c3b" and "55f2ae28dde7cee7f9f9b91115711081a7964e16" have entirely different histories.

52 changed files with 196 additions and 750 deletions

View File

@ -62,7 +62,7 @@ public class OrderApplicationService {
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId())) RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
.orElseThrow(() -> new NotFoundException(NOT_FOUND)); .orElseThrow(() -> new NotFoundException(NOT_FOUND));
order.reloadStatus(); order.reloadStatus();
List<Leg> legs = processLegData(addLegData.getLegData(), order); List<Leg> legs = processLegData(addLegData.getLegData(), order);
RouteOrder routeOrder = orderDomainService.saveOrder(order); RouteOrder routeOrder = orderDomainService.saveOrder(order);
legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue());
return routeOrder; // 仅在所有操作完成后保存一次 return routeOrder; // 仅在所有操作完成后保存一次

View File

@ -2,10 +2,10 @@ package com.chint.domain.aggregates.order;
import com.chint.domain.exceptions.LegEventException; import com.chint.domain.exceptions.LegEventException;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.service.amount_estimate.EstimateAdapter; import com.chint.domain.service.amount_estimate.EstimateAdapter;
import com.chint.domain.value_object.LegData; import com.chint.domain.value_object.LegData;
import com.chint.domain.value_object.enums.CurrencyType; import com.chint.domain.value_object.enums.CurrencyType;
import com.chint.infrastructure.util.BigDecimalCalculator;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -100,6 +100,24 @@ public class Leg {
// Set the legStatus based on the type of the latest event // Set the legStatus based on the type of the latest event
this.legStatus = latestEvent.getEventType(); 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); this.legStatusName = translateLegStatus(this.legStatus);
@ -111,8 +129,6 @@ public class Leg {
if (this.getLegExtensionField() != null && this.getLegExtensionField().getAmountType() != null) { if (this.getLegExtensionField() != null && this.getLegExtensionField().getAmountType() != null) {
this.getLegExtensionField().reloadStatus(); this.getLegExtensionField().reloadStatus();
} }
//
return this; return this;
} }
@ -189,12 +205,12 @@ public class Leg {
return this; return this;
} }
// 如果列表不为空确保新事件的类型是按顺序的与最后一个事件类型相同或者浮动为1 // 如果列表不为空确保新事件的类型是按顺序的或者与最后一个事件类型相同
if (!eventList.isEmpty()) { if (!eventList.isEmpty()) {
LegEvent lastEvent = eventList.get(eventList.size() - 1); LegEvent lastEvent = eventList.get(eventList.size() - 1);
int lastEventType = lastEvent.getEventType(); int lastEventType = lastEvent.getEventType();
if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 1) { if (newEventType != lastEventType && newEventType != lastEventType + 1) {
throw new LegEventException("New event must be the same as, immediately before, or immediately after the last event type."); throw new LegEventException("New event must be the same as the last event type or the next in sequence.");
} }
} }

View File

@ -4,6 +4,7 @@ import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column; 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 org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -26,8 +27,8 @@ public class LegEvent {
private LocalDateTime happenTime; private LocalDateTime happenTime;
@Transient @MappedCollection(idColumn = "leg_event_id",keyColumn = "leg_event_key")
private List<OrderDetail> orderDetailIds; private List<OrderDetail> orderDetails;
public String translateLegEvent(int event) { public String translateLegEvent(int event) {
return switch (event) { return switch (event) {
@ -46,4 +47,12 @@ public class LegEvent {
this.setEventName(translateLegEvent(this.eventType)); this.setEventName(translateLegEvent(this.eventType));
return this; return this;
} }
public LegEvent addOrderDetail(OrderDetail orderDetail){
if(this.orderDetails == null){
this.orderDetails = new ArrayList<>();
}
this.orderDetails.add(orderDetail);
return this;
}
} }

View File

@ -20,7 +20,6 @@ import static com.chint.infrastructure.constant.Constant.ORDER_EVENT_UNKNOWN;
public class OrderDetail { public class OrderDetail {
@Id @Id
private Long orderId; // 使用 order_id 作为主键 private Long orderId; // 使用 order_id 作为主键
private Long legId; // 使用行程节点关联leg
private String orderNo; private String orderNo;
private String supplierName; private String supplierName;
private Integer productType; // 商品类型 private Integer productType; // 商品类型

View File

@ -1,13 +1,11 @@
package com.chint.domain.aggregates.order; package com.chint.domain.aggregates.order;
import com.chint.application.commands.LegOrderedCommand;
import com.chint.domain.aggregates.base.BaseEntity; import com.chint.domain.aggregates.base.BaseEntity;
import com.chint.domain.factoriy.leg.LegFactory; import com.chint.domain.factoriy.leg.LegFactory;
import com.chint.domain.service.amount_estimate.EstimateAdapter; import com.chint.domain.service.amount_estimate.EstimateAdapter;
import com.chint.domain.value_object.LegData; import com.chint.domain.value_object.LegData;
import com.chint.domain.value_object.OrderSaveData; import com.chint.domain.value_object.OrderSaveData;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.BigDecimalCalculator; import com.chint.infrastructure.util.BigDecimalCalculator;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
@ -339,21 +337,4 @@ public class RouteOrder extends BaseEntity {
default -> "未知供应商"; 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());
}
} }

View File

@ -13,9 +13,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
@Override @Override
public OrderDetail create(OrderLegData orderLegData) { public OrderDetail create(OrderLegData orderLegData) {
OrderDetail orderDetail = OrderDetail.of(orderLegData.getOutOrderNo(), orderLegData.getSupplierName()); 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.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.setOrderDate(LocalDateTime.parse(orderLegData.getOrderTime(), dateTimeFormatter));
orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode())); orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
orderDetail.setDestinationId(orderLegData.getDestinationId()); orderDetail.setDestinationId(orderLegData.getDestinationId());

View File

@ -2,14 +2,11 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface OrderDetailRepository { public interface OrderDetailRepository {
OrderDetail findById(Long orderDetailId); OrderDetail findById(Long orderDetailId);
List<OrderDetail> findByLegId(Long legId);
Optional<OrderDetail> findByOrderNo(String orderNo); Optional<OrderDetail> findByOrderNo(String orderNo);
OrderDetail save(OrderDetail orderDetail); OrderDetail save(OrderDetail orderDetail);

View File

@ -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);
}
}

View File

@ -100,8 +100,4 @@ public class OrderDomainService {
//这里如果发现事件的状态为Approving2 需要根据发送审批给bpm需要先查询订单数据 //这里如果发现事件的状态为Approving2 需要根据发送审批给bpm需要先查询订单数据
} }
public void legAutoAddOrder(){
}
} }

View File

@ -4,7 +4,6 @@ import com.chint.application.commands.*;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.CommandException; import com.chint.domain.exceptions.CommandException;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.exceptions.OrderException; import com.chint.domain.exceptions.OrderException;
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.RouteOrderFactory;
@ -14,17 +13,12 @@ import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository; import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.order_sync.SyncAdapter; import com.chint.domain.service.order_sync.SyncAdapter;
import com.chint.domain.value_object.ApprovalLegData; import com.chint.domain.value_object.*;
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.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
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 org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.Optional; import java.util.Optional;
import static com.chint.infrastructure.constant.Constant.*; import static com.chint.infrastructure.constant.Constant.*;
@ -119,13 +113,9 @@ public class LegEventHandler implements LegEventService {
if (!syncAdapter.of(supplierName).syncSupplierOrder(routeOrder)) { if (!syncAdapter.of(supplierName).syncSupplierOrder(routeOrder)) {
throw new CommandException("订单提交失败"); throw new CommandException("订单提交失败");
} }
} } else {
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
throw new CommandException("订单未提交审批"); throw new CommandException("订单未提交审批");
} }
if (routeOrder.getOrderStatus() > (ORDER_STATUS_APPROVAL)) {
throw new CommandException("订单已同步");
}
} }
@Transactional @Transactional
@ -143,21 +133,39 @@ public class LegEventHandler implements LegEventService {
.stream() .stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(data.getOutOrderNo())) .filter(orderDetail -> orderDetail.getOrderNo().equals(data.getOutOrderNo()))
.findFirst(); .findFirst();
if (byOrderNo.isEmpty()) { if (byOrderNo.isEmpty())
// {
// //如果订单以及存在了对订单的状态进行更新
// OrderEvent event = orderDetailFactory.createEvent(data.getOrderStatus(), data.getOriginOrderStatus());
// OrderDetail orderDetail = byOrderNo.get();
// orderDetail.addOrderEvent(event);
// } else
{
//否则创建新的订单添加到routeOrder //否则创建新的订单添加到routeOrder
OrderDetail orderDetail = orderDetailFactory.create(data) OrderDetail orderDetail = orderDetailFactory.create(data)
.price(data.getPrice()).productType(data.getProductType()); .price(data.getPrice()).productType(data.getProductType());
//为订单添加订单已下单事件
// OrderEvent orderEvent = orderDetailFactory.createEvent(ORDER_EVENT_PREPARE, data.getOriginOrderStatus());
// orderDetail.addOrderEvent(orderEvent);
routeOrder.addOrderDetail(orderDetail); routeOrder.addOrderDetail(orderDetail);
//结合外部订单信息筛选最合适的leg节点 触发下单事件; 这里另外发送一个命令用于处理leg和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);
});
} }
routeOrder = routeRepository.save(routeOrder); routeRepository.save(routeOrder);
OrderDetail orderDetail = routeOrder
.getOrderDetails()
.stream()
.max(Comparator.comparing(OrderDetail::getCreateTime))
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理
routeOrder.matchOrderWithLeg(orderDetail);
} }
@Transactional @Transactional
@ -165,22 +173,25 @@ public class LegEventHandler implements LegEventService {
public void orderLeg(LegOrderedCommand command) { public void orderLeg(LegOrderedCommand command) {
//如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件 //如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
//因为orderDetail已经进行持久化保存 只需要从数据库进行查询 //因为orderDetail已经进行持久化保存 只需要从数据库进行查询
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId()); OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
LegEvent legEvent = legEventFactory LegEvent legEvent = legEventFactory
.creatLegEvent(command.getLegEventType()); .creatLegEvent(command.getLegEventType())
.addOrderDetail(orderDetail);
leg.addEvent(legEvent); leg.addEvent(legEvent);
orderDetail.setLegId(leg.getLegId());
legRepository.save(leg); legRepository.save(leg);
orderDetailRepository.save(orderDetail);
} }
@Transactional @Transactional
@Override @Override
public void payForLeg(LegPayedCommand command) { public void payForLeg(LegPayedCommand command) {
// PayLegData data = command.getData(); PayLegData data = command.getData();
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
OrderDetail orderDetail = new OrderDetail();
legEvent.addOrderDetail(orderDetail);
leg.addEvent(legEvent); leg.addEvent(legEvent);
legRepository.save(leg); legRepository.save(leg);
} }

View File

@ -4,7 +4,6 @@ import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.OrderDomainService; import com.chint.domain.service.OrderDomainService;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYPostRequest;
@ -30,9 +29,6 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
@Autowired @Autowired
private OrderDomainService orderDomainService; private OrderDomainService orderDomainService;
@Autowired
private UserRepository userRepository;
@Override @Override
public boolean syncSupplierOrder(RouteOrder order) { public boolean syncSupplierOrder(RouteOrder order) {
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址 String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址
@ -90,54 +86,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
//作废状态2 //作废状态2
order.setStatus(2); order.setStatus(2);
System.out.println("开始取消同程订单"); System.out.println("开始取消同程订单");
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址 return syncSupplierOrder(order);
//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);
} }
//同程Leg集合解析 //同程Leg集合解析

View File

@ -111,11 +111,9 @@ public class Constant {
public static final String LEG_OTHER_AMOUNT_BUS_EN_NAME = "CoachBus"; 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_FLY = 1; //飞机
public static final int PRODUCT_TYPE_COMMON = 0; //通用推送 public static final int PRODUCT_TYPE_TRAIN_CAR = 2; //用车
public static final int PRODUCT_TYPE_CHAILORDER = 4; //差旅单推送
public static final int PRODUCT_TYPE_TRAIN_CAR = 6; //用车
public static final int PRODUCT_TYPE_TRAIN_HOTEL = 3; //酒店 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 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 int ORDER_EVENT_REFUND = 4;
public static final String ORDER_EVENT_REFUND_NAME = "退票";
public static final int ORDER_EVENT_FINISH = 5; public static final int ORDER_EVENT_FINISH = 5;
public static final String ORDER_EVENT_FINISH_NAME = "已完成"; 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 int ORDER_EVENT_CANCEL = -1;
public static final String ORDER_EVENT_CANCEL_NAME = "取消"; public static final String ORDER_EVENT_CANCEL_NAME = "取消";
public static final int ORDER_EVENT_UNKNOWN = -99; 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_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_TOKEN_PATH = "/api/OAuth/v2/GetAccessToken";
public static final String L_Y_ORDER_PATH = "/api/TravelApplyOrder/ApplyOrderSync"; 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_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_THREE = "STANDARD_LEVEL_THREE";//方法名称
public static final String STANDARD_LEVEL_FOUR = "STANDARD_LEVEL_FOUR";//方法名称 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";
} }

View File

@ -1,6 +1,7 @@
package com.chint.infrastructure.echo_framework.manager; 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.ListenTo;
import com.chint.infrastructure.echo_framework.annotation.TransitionTo; import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
import com.chint.infrastructure.echo_framework.command.Command; 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.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate; 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.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
@ -84,17 +87,14 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini
List<MethodContainer> containers = listenerMethods.getOrDefault(command.getCommandName(), Collections.emptyList()); List<MethodContainer> containers = listenerMethods.getOrDefault(command.getCommandName(), Collections.emptyList());
List<ResultContainer> resultContainers = new ArrayList<>(); List<ResultContainer> resultContainers = new ArrayList<>();
containers.forEach(container -> { containers.forEach(container -> {
Object result = null;
try { try {
result = container.getMethod().invoke(container.getBean(), command); Object result = container.getMethod().invoke(container.getBean(), command);
if (result instanceof ResultContainer) {
resultContainers.add((ResultContainer) result);
}
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e); e.printStackTrace(); // Handle exceptions appropriately
} }
if (result instanceof ResultContainer) {
resultContainers.add((ResultContainer) result);
}
}); });
return resultContainers; return resultContainers;
} }

View File

@ -8,7 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.lang.reflect.InvocationTargetException; import java.util.Optional;
@RestControllerAdvice @RestControllerAdvice
@Slf4j @Slf4j
@ -37,23 +37,4 @@ public class GlobalExceptionHandler {
public Result<String> handleDuplicateException(HttpServletRequest request, DuplicateException e) { public Result<String> handleDuplicateException(HttpServletRequest request, DuplicateException e) {
return Result.error(e.getMessage()); 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);
// }
}
} }

View File

@ -7,7 +7,6 @@ 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.List;
import java.util.Optional; import java.util.Optional;
import static com.chint.infrastructure.constant.Constant.NOT_FOUND; 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)); return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
} }
@Override
public List<OrderDetail> findByLegId(Long legId) {
return orderDetailRepository.findByLegId(legId);
}
@Override @Override
public Optional<OrderDetail> findByOrderNo(String orderNo) { public Optional<OrderDetail> findByOrderNo(String orderNo) {
return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo)); return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo));

View File

@ -1,12 +1,10 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.location.CityEntity; import com.chint.domain.aggregates.location.CityEntity;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCityRepository extends CrudRepository<CityEntity,Long> { public interface JdbcCityRepository extends CrudRepository<CityEntity,Long> {
CityEntity findByCityName(String cityName); CityEntity findByCityName(String cityName);
} }

View File

@ -4,12 +4,8 @@ import com.chint.domain.aggregates.order.OrderDetail;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, Long> { public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, Long> {
OrderDetail findByOrderNo(String orderNo); OrderDetail findByOrderNo(String orderNo);
List<OrderDetail> findByLegId(Long legId);
} }

View File

@ -10,5 +10,4 @@ import java.util.List;
public interface JdbcRanksRepository extends CrudRepository<Ranks, Integer> { public interface JdbcRanksRepository extends CrudRepository<Ranks, Integer> {
Ranks findByCompanyCodeAndRankName(String companyCode, String rankName); Ranks findByCompanyCodeAndRankName(String companyCode, String rankName);
List<Ranks> findByCompanyCode(String companyCode); List<Ranks> findByCompanyCode(String companyCode);
} }

View File

@ -10,5 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
@NoArgsConstructor @NoArgsConstructor
public class CTripNoteResponse { public class CTripNoteResponse {
private String errorCode; private String errorCode;
private String errorMessage; private String errorMessage;
} }

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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; // 推送唯一秘钥
}

View File

@ -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;//数据
}

View File

@ -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;//返回消息
}

View File

@ -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; //超标原因 是否必填
}

View File

@ -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;//原因 是否必填:
}

View File

@ -1,6 +1,5 @@
package com.chint.interfaces.rest.ly.dto.carorderdatapushback; 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 com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -9,6 +8,11 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@AllArgsConstructor @AllArgsConstructor
public class NotificationCar extends Notification { public class Notification {
private NotifyData notifyData; private NotifyData notifyData;
private int notifyType; //推送类型
private int subNotifyType; //推送子类型
private long notifyTime; //推送时间戳
private String sign; //推送签名
private String soleKey; // 推送唯一秘钥
} }

View File

@ -4,8 +4,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@ -14,7 +12,4 @@ public class NotifyData {
private OrderDriver orderDriver; private OrderDriver orderDriver;
private OrderExtend orderExtend; private OrderExtend orderExtend;
private TravelData travelData; private TravelData travelData;
private List<PriceDetail> priceDetailList;
private List<SubmitItem> submitItemList;
} }

View File

@ -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; // 推送唯一秘钥
}

View File

@ -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;
}

View File

@ -48,9 +48,6 @@ public class OrderDetails {
private Integer refId; private Integer refId;
private boolean ruleViolate; private boolean ruleViolate;
private RuleViolateDetail ruleViolateDetail; private RuleViolateDetail ruleViolateDetail;
private TravelData travelData;
private List<Passenger> passengerList;
private List<FlightSegment> flightSegmentList;
private String foulReason; private String foulReason;
private String foulReasonCode; private String foulReasonCode;
private String foulReasonNote; private String foulReasonNote;

View File

@ -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; // 推送唯一秘钥
}

View File

@ -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;
}

View File

@ -47,14 +47,6 @@ public class OrderInfo {
private String supplierOrderCreateTime; private String supplierOrderCreateTime;
private boolean ruleViolate; private boolean ruleViolate;
private RuleViolateDetail ruleViolateDetail; 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 foulReason;
private String foulReasonCode; private String foulReasonCode;
private String foulReasonNote; private String foulReasonNote;

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,6 +1,5 @@
package com.chint.interfaces.rest.ly.dto.ticketpush; package com.chint.interfaces.rest.ly.dto.ticketpush;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;

View File

@ -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; // 推送唯一秘钥
}

View File

@ -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;
}

View File

@ -4,47 +4,17 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@AllArgsConstructor @AllArgsConstructor
public class NotifyData { public class NotifyData {
private String orderNo; private String orderNo;
private String outOrderNo; private String outOrderNo;
private String issueTime;
private String msgCode; private String msgCode;
private String msgInfo; 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 String ticketGate;
private List<Passenger> passengers; private String fInfo;
private boolean isSelfToProxy;
private String isChangedOrder;
private String originalOrderNo; private String originalOrderNo;
private String changedType; private TravelData travelData;
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;
} }

View File

@ -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...
}

View File

@ -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...
}

View File

@ -4,11 +4,13 @@ import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.service.supplier.SupplierService;
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 com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse; 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.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.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -32,9 +34,8 @@ public class CarBackController {
@PostMapping("/back") @PostMapping("/back")
public CTripNoteResponse carBack(@RequestBody Notification notification) {
public LYNoteResponse carBack(@RequestBody NotificationCar notificationCar) { String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
String orderSerialNo = notificationCar.getNotifyData().getOrderSerialNo();
if (orderSerialNo != null) { if (orderSerialNo != null) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderSerialNo); CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderSerialNo);
String outEmployeeId = carDetailResponse.getData().getOutEmployeeId(); //外部员工id String outEmployeeId = carDetailResponse.getData().getOutEmployeeId(); //外部员工id
@ -47,13 +48,13 @@ public class CarBackController {
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(serialNo) .orderNo(serialNo)
.outStatus(String.valueOf(notificationCar.getSubNotifyType())); .outStatus(String.valueOf(notification.getSubNotifyType()));
command.eventType(carStatus(notificationCar.getSubNotifyType())); command.eventType(carStatus(notification.getSubNotifyType()));
command.sendToQueue(); command.sendToQueue();
return new LYNoteResponse("100", "成功收到消息"); return new CTripNoteResponse("0", "成功收到消息");
} }
return new LYNoteResponse("200", "未收到消息"); return new CTripNoteResponse("1", "未收到消息");
} }
public Integer carStatus(Integer status) { public Integer carStatus(Integer status) {
return switch (status) { return switch (status) {

View File

@ -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", "失败");
};
}
}

View File

@ -4,10 +4,12 @@ import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.service.supplier.SupplierService;
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 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.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.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 com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -33,8 +35,8 @@ public class FlyBackController {
//机票订单数据回推 //机票订单数据回推
@PostMapping("/back") @PostMapping("/back")
public LYNoteResponse ticketBack(@RequestBody NotificationFly notificationFly) { public CTripNoteResponse ticketBack(@RequestBody Notification notification) {
String orderSerialNo = notificationFly.getOrderDetails().getOrderSerialNo(); String orderSerialNo = notification.getOrderDetails().getOrderSerialNo();
if (orderSerialNo != null) { if (orderSerialNo != null) {
FlightOrderDetail flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderSerialNo); FlightOrderDetail flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderSerialNo);
String outEmployeeId = flightOrderDetail.getData().getOrderDetails().getOutEmployeeId();//外部员工id String outEmployeeId = flightOrderDetail.getData().getOrderDetails().getOutEmployeeId();//外部员工id
@ -46,12 +48,12 @@ public class FlyBackController {
supplierService.handleSupplierCallback(supplierCallbackData); supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(serialNo) .orderNo(serialNo)
.outStatus(String.valueOf(notificationFly.getSubNotifyType())); .outStatus(String.valueOf(notification.getSubNotifyType()));
command.eventType(mapFlightStatus(notificationFly.getSubNotifyType())); command.eventType(mapFlightStatus(notification.getSubNotifyType()));
command.sendToQueue(); command.sendToQueue();
return new LYNoteResponse("100", "成功收到消息"); return new CTripNoteResponse("0", "成功收到消息");
} }
return new LYNoteResponse("200", "未收到消息"); return new CTripNoteResponse("1", "未收到消息");
} }
public Integer mapFlightStatus(Integer status) { public Integer mapFlightStatus(Integer status) {

View File

@ -6,10 +6,11 @@ import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest; import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse; 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.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.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -31,12 +32,14 @@ public class HotelBackController {
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@Autowired
private CTripOrderSearchRequest cTripOrderSearchRequest;
@PostMapping("/back") @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) { if (orderSerialNo != null) {
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderSerialNo); HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderSerialNo);
String outEmployeeId = hotelOrderDetail.getData().getOrderInfo().getOutEmployeeId();//外部员工id String outEmployeeId = hotelOrderDetail.getData().getOrderInfo().getOutEmployeeId();//外部员工id
@ -49,13 +52,13 @@ public class HotelBackController {
supplierService.handleSupplierCallback(supplierCallbackData); supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(serialNo) .orderNo(serialNo)
.outStatus(String.valueOf(notificationHotel.getSubNotifyType())); .outStatus(String.valueOf(notification.getSubNotifyType()));
//状态映射 //状态映射
command.eventType(mapHotelState(notificationHotel.getSubNotifyType())); command.eventType(mapHotelState(notification.getSubNotifyType()));
command.sendToQueue(); command.sendToQueue();
return new LYNoteResponse("100", "成功收到消息"); return new CTripNoteResponse("0", "成功收到消息");
} }
return new LYNoteResponse("200", "未收到消息"); return new CTripNoteResponse("1", "未收到消息");
} }

View File

@ -4,11 +4,12 @@ import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.service.supplier.SupplierService;
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 com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse; 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.LYSearchRequest;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -31,8 +32,8 @@ public class TrainBackController {
private SupplierService supplierService; private SupplierService supplierService;
@PostMapping("/back") @PostMapping("/back")
public LYNoteResponse trainBack(@RequestBody NotificationTrain notificationTrain) { public CTripNoteResponse trainBack(@RequestBody Notification notification) {
String orderSerialNo = notificationTrain.getNotifyData().getOrderNo(); String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
if (orderSerialNo != null) { if (orderSerialNo != null) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderSerialNo); TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderSerialNo);
String outEmployeeId = trainOrderDetail.getData().getOutEmployeeId();//外部员工id String outEmployeeId = trainOrderDetail.getData().getOutEmployeeId();//外部员工id
@ -44,13 +45,13 @@ public class TrainBackController {
supplierService.handleSupplierCallback(supplierCallbackData); supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(serialNo) .orderNo(serialNo)
.outStatus(String.valueOf(notificationTrain.getSubNotifyType())); .outStatus(String.valueOf(notification.getSubNotifyType()));
command.eventType(mapTrainState(notificationTrain.getSubNotifyType())); command.eventType(mapTrainState(notification.getSubNotifyType()));
command.sendToQueue(); command.sendToQueue();
return new LYNoteResponse("100", "成功收到消息"); return new CTripNoteResponse("0", "成功收到消息");
} }
return new LYNoteResponse("200", "未收到消息"); return new CTripNoteResponse("1", "未收到消息");
} }
public Integer mapTrainState(Integer status) { public Integer mapTrainState(Integer status) {
return switch (status) { return switch (status) {

View File

@ -2,8 +2,6 @@ package com.chint;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository; 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.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ctrip.*; 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.BookingRelatedApiRequest;
@ -24,8 +22,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.Constant.SUPPLIER_C_TRIP;
@SpringBootTest @SpringBootTest
public class CTripTest { public class CTripTest {
@ -47,9 +43,6 @@ public class CTripTest {
@Autowired @Autowired
private CTripLoginRequest loginRequest; private CTripLoginRequest loginRequest;
@Autowired
private SupplierService supplierService;
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
//@Test //@Test
@ -148,14 +141,4 @@ public class CTripTest {
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30469349853"); SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30469349853");
System.out.println(response); 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);
}
} }

View File

@ -4,25 +4,16 @@ import com.chint.domain.aggregates.base.BaseEntity;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.constant.Constant; import com.chint.infrastructure.constant.Constant;
import com.chint.infrastructure.util.BaseContext; 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.LYLoginRequest;
import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYTokenRequest; import com.chint.interfaces.rest.ly.LYTokenRequest;
import com.chint.interfaces.rest.ly.LYUserRequest; import com.chint.interfaces.rest.ly.LYUserRequest;
import com.chint.interfaces.rest.ly.dto.applyordersync.*; 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.commonresult.Result;
import com.chint.interfaces.rest.ly.dto.estimateprice.*; 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.HotelListVo;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo; import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson; 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.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -52,9 +43,6 @@ public class LYTest {
@Autowired @Autowired
private LYLoginRequest loginRequest; 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_BASE_URL = "https://api.qa.dttrip.cn/openapi";
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync"; 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 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 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 user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063"); private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
@ -141,8 +126,8 @@ public class LYTest {
System.out.println(max); System.out.println(max);
} }
// @Test // @Test
//外部差旅单同步 //外部差旅单同步
void ApplyOrderSync() { void ApplyOrderSync() {
AOSParam aosParam = new AOSParam(); AOSParam aosParam = new AOSParam();
aosParam.setOutTravelApplyNo("No000001"); aosParam.setOutTravelApplyNo("No000001");
@ -277,79 +262,29 @@ public class LYTest {
System.out.println(post); System.out.println(post);
} }
// @Test // @Test
void loadToken() { void loadToken() {
System.out.println(lyTokenRequest.loadToken()); System.out.println(lyTokenRequest.loadToken());
} }
// @Test // @Test
void saveCurrentUser2Ly() { void saveCurrentUser2Ly() {
// BaseContext.setCurrentUser(user); // BaseContext.setCurrentUser(user);
BaseContext.setCurrentUser(hxh); BaseContext.setCurrentUser(hxh);
System.out.println(lyUserRequest.saveCurrentUser()); System.out.println(lyUserRequest.saveCurrentUser());
} }
// @Test // @Test
void loginLY() { void loginLY() {
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME)); System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
} }
// @Test // @Test
void loginLYPC() { void loginLYPC() {
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME)); 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);
}
} }

View File

@ -12,8 +12,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
@SpringBootTest @SpringBootTest
@ -36,13 +34,6 @@ class RouteApplicationTests {
userHttpRequest.loadUserInfo(user); 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 @Test
void loginSign() { void loginSign() {
String sfno = "230615020"; String sfno = "230615020";