同步同程订单接口的测试调整
This commit is contained in:
parent
d1408e39d9
commit
aea8ca7f0c
|
@ -95,6 +95,7 @@ public class RouteOrder extends BaseEntity {
|
||||||
this.getLegItems().forEach(Leg::reloadStatus);
|
this.getLegItems().forEach(Leg::reloadStatus);
|
||||||
this.estimateAmount = this.getLegItems()
|
this.estimateAmount = this.getLegItems()
|
||||||
.stream()
|
.stream()
|
||||||
|
.filter(leg -> leg.getEstimateAmount() != null)
|
||||||
.map(Leg::getEstimateAmount)
|
.map(Leg::getEstimateAmount)
|
||||||
.reduce(BigDecimalCalculator::add)
|
.reduce(BigDecimalCalculator::add)
|
||||||
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.domain.service.amount_estimate;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
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.service.OrderDomainService;
|
||||||
import com.chint.infrastructure.constant.Constant;
|
import com.chint.infrastructure.constant.Constant;
|
||||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class LegEventHandler implements LegEventService{
|
||||||
@Override
|
@Override
|
||||||
public void approveLeg(LegApprovalCommand command) {
|
public void approveLeg(LegApprovalCommand command) {
|
||||||
ApproveLegData data = command.getData();
|
ApproveLegData data = command.getData();
|
||||||
RouteOrder routeOrder = routeRepository.findByFakeOrderNo(data.getFakeOrderNo());
|
RouteOrder routeOrder = routeRepository.findByFakeOrderNo(data.getFakeOrderNo()).reloadStatus();
|
||||||
|
|
||||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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.service.OrderDomainService;
|
||||||
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.ly.LYPostRequest;
|
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||||
|
@ -26,6 +27,9 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
||||||
@Autowired
|
@Autowired
|
||||||
private LocationRepository locationRepository;
|
private LocationRepository locationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderDomainService orderDomainService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean syncSupplierOrder(RouteOrder order) {
|
public boolean syncSupplierOrder(RouteOrder order) {
|
||||||
String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;//请求地址
|
String supplierOrderSyncUrl = Constant.L_Y_BASE_URL + Constant.L_Y_ORDER_PATH;//请求地址
|
||||||
|
@ -44,7 +48,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
||||||
param.setOperationType(1);//1新增,2更新
|
param.setOperationType(1);//1新增,2更新
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
User user = BaseContext.getCurrentUser();
|
User user = BaseContext.getCurrentUser();
|
||||||
param.setOutEmployeeId(String.valueOf(user.getUserId()));//用户id
|
param.setOutEmployeeId(String.valueOf(user.getEmployeeNo()));//用户id
|
||||||
param.setTravelDescription("同程订单");//描述信息
|
param.setTravelDescription("同程订单");//描述信息
|
||||||
param.setBookableProducts("1,3,5");//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
param.setBookableProducts("1,3,5");//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
||||||
//2.同程的行程节点集合
|
//2.同程的行程节点集合
|
||||||
|
@ -70,13 +74,15 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
||||||
param.setApproveRuleType(0);//审批规则
|
param.setApproveRuleType(0);//审批规则
|
||||||
SupplierOrderSyncDto supplierOrderSyncDto = new SupplierOrderSyncDto();
|
SupplierOrderSyncDto supplierOrderSyncDto = new SupplierOrderSyncDto();
|
||||||
supplierOrderSyncDto.setParam(param);
|
supplierOrderSyncDto.setParam(param);
|
||||||
Result post = postRequest.post(supplierOrderSyncUrl, supplierOrderSyncDto, Result.class);
|
Result result = postRequest.post(supplierOrderSyncUrl, supplierOrderSyncDto, Result.class);
|
||||||
System.out.println("post = " + post);
|
System.out.println("result = " + result);
|
||||||
System.out.println("开始同步同程订单");
|
System.out.println("开始同步同程订单");
|
||||||
|
String success = result.getSuccess();
|
||||||
|
return Boolean.parseBoolean(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
//同程Leg集合解析
|
//同程Leg集合解析
|
||||||
private static ArrayList<AOSItem> getAosItems(RouteOrder order) {
|
private ArrayList<AOSItem> getAosItems(RouteOrder order) {
|
||||||
ArrayList<AOSItem> aosItems = new ArrayList<>();
|
ArrayList<AOSItem> aosItems = new ArrayList<>();
|
||||||
AOSItem aosItem = new AOSItem();
|
AOSItem aosItem = new AOSItem();
|
||||||
LocalDateTime startDate = LocalDateTime.MAX;
|
LocalDateTime startDate = LocalDateTime.MAX;
|
||||||
|
@ -85,6 +91,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
||||||
StringBuilder arriveCityStr = new StringBuilder();
|
StringBuilder arriveCityStr = new StringBuilder();
|
||||||
//提取所有行程节点信息
|
//提取所有行程节点信息
|
||||||
List<Leg> legItems = order.getLegItems();
|
List<Leg> legItems = order.getLegItems();
|
||||||
|
orderDomainService.queryLocation(legItems);
|
||||||
for (Leg leg : legItems) {
|
for (Leg leg : legItems) {
|
||||||
//开始时间
|
//开始时间
|
||||||
LocalDateTime startTime = leg.getStartTime();
|
LocalDateTime startTime = leg.getStartTime();
|
||||||
|
|
Loading…
Reference in New Issue