同步接口修改抛出异常

This commit is contained in:
lulz1 2024-02-17 12:10:26 +08:00
parent aea8ca7f0c
commit 94c04eccda
71 changed files with 1211 additions and 197 deletions

View File

@ -20,7 +20,7 @@ public class SupplierLoginController {
@Autowired
private SupplierLoginService supplierLoginService;
@ApiOperation("单点登录同程")
@ApiOperation("单点登录同程-移动")
@PostMapping("/ly/login")
public Result<LYRedirectUrlResponse> lyLogin() {
//登录
@ -28,7 +28,15 @@ public class SupplierLoginController {
return Result.Success(SUCCESS, data);
}
@ApiOperation("单点登录携程")
@ApiOperation("单点登录同程-PC")
@PostMapping("/ly/login")
public Result<LYRedirectUrlResponse> lyLoginPC() {
//登录
LYRedirectUrlResponse data = supplierLoginService.lyLoginPC();
return Result.Success(SUCCESS, data);
}
@ApiOperation("单点登录携程-移动")
@PostMapping("/CTrip/login")
public Result<H5Response> cTripLogin() {
return Result.Success(SUCCESS, supplierLoginService.cTripLogin());

View File

@ -4,19 +4,21 @@ import com.chint.application.commands.*;
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.exceptions.OrderException;
import com.chint.domain.factoriy.leg.LegFactory;
import com.chint.domain.factoriy.order.OrderFactory;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.service.OrderDomainService;
import com.chint.domain.value_object.*;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import static com.chint.infrastructure.constant.Constant.NOT_FOUND;
import static com.chint.infrastructure.constant.Constant.*;
@Service
public class OrderApplicationService {
@ -40,6 +42,9 @@ public class OrderApplicationService {
order = Optional.ofNullable(routeRepository.queryById(orderSaveData.getRouteId()))
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
order.reloadStatus(orderSaveData, legFactory);
if(!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)){
throw new OrderException(DATA_INVALID);
}
} else {
// order = orderFactory.createOrder(orderSaveData);
throw new NotFoundException(NOT_FOUND);

View File

@ -26,6 +26,10 @@ public class SupplierLoginService {
return lyLoginRequest.login(L_Y_ENTRANCE_HOME);
}
public LYRedirectUrlResponse lyLoginPC() {
return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME);
}
public H5Response cTripLogin() {
return cTripLoginRequest.hSingleLogin();
}

View File

@ -0,0 +1,7 @@
package com.chint.domain.exceptions;
public class OrderException extends BaseException{
public OrderException(String msg) {
super(msg);
}
}

View File

@ -1,6 +1,7 @@
package com.chint.domain.service.order_sync;
import com.chint.domain.aggregates.order.ApproveOrderNo;
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository;
@ -9,16 +10,22 @@ import com.chint.domain.service.OrderDomainService;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult;
import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.air.FlightEndorsementDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.quick.CarQuickEndorsementDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.quick.RankInfo;
import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.Constant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.Constant.*;
@Component
public class CTripOrderSyncAdapter implements SupplierOrderSync {
@ -29,10 +36,6 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
@Autowired
private CTripApprovalRequest approvalRequest;
@Autowired
private LocationRepository locationRepository;
@Autowired
private OrderDomainService orderDomainService;
@ -42,27 +45,85 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
User currentUser = BaseContext.getCurrentUser();
ApproveOrderNo approveOrderNo = order.getApproveOrderNo();
RankInfo rankInfo = RankInfo.of(currentUser.getRankCode());
List<String> cityCode = new ArrayList<>();
Map<Integer, List<Leg>> collect = orderDomainService.queryLocation(order.getLegItems())
.stream().collect(Collectors.groupingBy(Leg::getLegType));
ApprovalRequest approvalRequestParam = ApprovalRequest
.buildApproval(approveOrderNo.getActualOrderNo(), String.valueOf(currentUser.getEmployeeNo()), rankInfo);
collect.forEach((k, v) -> {
switch (k) {
case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v));
case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v));
case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v));
case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v));
}
});
ApprovalResult approval = approvalRequest.approval(approvalRequestParam);
return approval.getSetApprovalResult().getStatus().getSuccess();
}
private List<HotelEndorsementDetail> generateHotelList(List<Leg> legs) {
List<HotelEndorsementDetail> hotelList = new ArrayList<>();
orderDomainService.queryLocation(order.getLegItems())
.forEach(
leg -> {
cityCode.add(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
);
if (leg.getLegType().equals(LEG_TYPE_HOTEL)) {
legs.forEach(leg -> {
hotelList.add(
HotelEndorsementDetail.of(cityCode.stream().distinct().toList())
.passenger(PassengerDetail.of(String.valueOf(currentUser.getEmployeeNo())))
HotelEndorsementDetail.of(List.of(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
))
.passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
.starTime(leg.getStartTime())
.endTime(leg.getEndTime())
);
});
return hotelList;
}
}
private List<FlightEndorsementDetail> generateFilghtList(List<Leg> legs) {
List<FlightEndorsementDetail> filghtList = new ArrayList<>();
legs.forEach(leg -> {
filghtList.add(
FlightEndorsementDetail.of(List.of(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
), List.of(
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
))
.passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
.starTime(leg.getStartTime())
.endTime(leg.getEndTime())
);
ApprovalRequest approvalRequestParam = ApprovalRequest.buildApproval(String.valueOf(currentUser.getEmployeeNo()), approveOrderNo.getActualOrderNo(), rankInfo)
.withHotel(hotelList);
approvalRequest.approval(approvalRequestParam);
return false;
});
return filghtList;
}
private List<TrainEndorsementDetail> generateTrainList(List<Leg> legs) {
List<TrainEndorsementDetail> trainList = new ArrayList<>();
legs.forEach(leg -> {
trainList.add(
TrainEndorsementDetail.of(List.of(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
), List.of(
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
)).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
.starTime(leg.getStartTime())
.endTime(leg.getEndTime())
);
});
return trainList;
}
private List<CarQuickEndorsementDetail> generateCarList(List<Leg> legs) {
List<CarQuickEndorsementDetail> carList = new ArrayList<>();
legs.forEach(leg -> {
carList.add(
CarQuickEndorsementDetail.of(List.of(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
)).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
.starTime(leg.getStartTime())
.endTime(leg.getEndTime())
);
});
return carList;
}
}

View File

@ -142,6 +142,7 @@ public class Constant {
public static final String C_TRIP_APP_KEY = "obk_zhengtai2024"; // 测试appkey
public static final String C_TRIP_APP_SECURITY = "fI3}FZX+zUdxPa2W!R6I2gYO"; // 测试app秘钥
public static final String C_TRIP_H5_LOGIN = "/corpservice/authorize/getticket"; // 测试app秘钥
public static final String C_TRIP_ORDER_SEARCH_PATH = "/switchapi/Order/SearchOrder"; // 测试app秘钥
public static final String USER_SAVE_PATH = "/corpservice/CorpCustService/SaveCorpCustInfoList";
public static final String HOTEL_CITY_PATH = "/corpopenapi/HotelCity/GetCountryCityExtend";
public static final String HOTEL_COUNTRY_PATH = "/corpopenapi/HotelCity/GetCountry";
@ -155,7 +156,6 @@ public class Constant {
public static final String C_TRIP_APPROVAL_PATH = "/switchapi/approval.svc/rest/setapproval";
public static final String C_TRIP_ESTIMATE_PATH = "/bookingrelatedservice/bookingrelatedopenapi";
public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken";
public static final String C_TRIP_ORDER_SEARCH_PATH = "/switchapi/Order/SearchOrder";
public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login";

View File

@ -4,6 +4,7 @@ package com.chint.infrastructure.handler;
import com.chint.domain.exceptions.CommandException;
import com.chint.domain.exceptions.LegEventException;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.exceptions.OrderException;
import com.chint.infrastructure.util.Result;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
@ -29,4 +30,9 @@ public class GlobalExceptionHandler {
public Result<String> handleCommandException(HttpServletRequest request, CommandException e) {
return Result.error(e.getMessage());
}
@ExceptionHandler(OrderException.class)
public Result<String> handleOrderException(HttpServletRequest request, OrderException e) {
return Result.error(e.getMessage());
}
}

View File

@ -2,6 +2,7 @@ package com.chint.interfaces.rest.ctrip;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequestOut;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult;
import com.chint.interfaces.rest.ctrip.dto.Authentication;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,9 +22,11 @@ public class CTripApprovalRequest {
private PostRequest postRequest;
public ApprovalResult approval(ApprovalRequest approvalRequest) {
ApprovalRequestOut approvalRequestOut = new ApprovalRequestOut();
approvalRequestOut.setRequest(approvalRequest);
String ticket = ticketRequest.loadTicket();
approvalRequest.setStatus(0);
approvalRequest.setStatus(1);
approvalRequest.setAuth(Authentication.of(C_TRIP_APP_KEY, ticket));
return postRequest.post(approvalUrl, approvalRequest, ApprovalResult.class);
return postRequest.post(approvalUrl, approvalRequestOut, ApprovalResult.class);
}
}

View File

@ -0,0 +1,33 @@
package com.chint.interfaces.rest.ctrip;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.Constant.*;
@Service
public class CTripOrderSearchRequest {
private String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH;
@Autowired
private PostRequest postRequest;
@Autowired
private CTripTicketRequest ticketRequest;
public SearchOrderResponse searchOrder(String journeyNo) {
String ticket = ticketRequest.loadTicket();
SearchOrderRequest request = SearchOrderRequest
.builder()
.authInfo()
.details(C_TRIP_APP_KEY, ticket)
.done()
.language(LANGUAGE_CN)
.journeyNo(journeyNo)
.done();
return postRequest.post(searchUrl, request, SearchOrderResponse.class);
}
}

View File

@ -6,8 +6,8 @@ import lombok.Data;
@Data
@AllArgsConstructor
public class Authentication {
private String appKey;
private String ticket;
private String AppKey;
private String Ticket;
// Getters and setters...
public static Authentication of(String appKey, String ticket) {

View File

@ -18,108 +18,109 @@ import java.util.List;
public class ApprovalRequest {
// 审批单号 - 必填
// OA审批通过时生成同步审批单编号用于标识审批单
private String approvalNumber;
private String ApprovalNumber;
// 状态 - 必填
// 0为审批中1为审批通过2为审批拒绝
private int status;
// 1
private int Status;
// 携程卡号 - 非必填
// N表示非必填多个携程卡号以逗号隔开长度不能超过500个字符且不重复
private String ctripCardNO;
private String CtripCardNO;
// 员工编号 - 非必填
// N表示非必填多个员工编号以逗号隔开长度不能超过500个字符且不重复
private String employeeID;
private String EmployeeID;
// 机票背书信息详情列表 - 必填
// Y表示必填项用于记录一条审批单中的一条或多条航班信息详细信息格式见3.3.2节的JSON数据交互格式详细说明
private List<FlightEndorsementDetail> flightEndorsementDetails;
private List<FlightEndorsementDetail> FlightEndorsementDetails;
// 酒店背书信息详情列表 - 必填
// Y表示必填项
private List<HotelEndorsementDetail> hotelEndorsementDetails;
private List<HotelEndorsementDetail> HotelEndorsementDetails;
// 火车背书信息详情列表 - 必填
// Y表示必填项
private List<TrainEndorsementDetail> trainEndorsementDetails;
private List<TrainEndorsementDetail> TrainEndorsementDetails;
// 租车背书信息详情列表 - 必填
// Y表示必填项
private List<CarQuickEndorsementDetail> carQuickEndorsementDetails;
private List<CarQuickEndorsementDetail> CarQuickEndorsementDetails;
// 接送车背书信息详情列表 - 必填
// Y表示必填项
private List<CarPickUpEndorsementDetail> carPickUpEndorsementDetails;
private List<CarPickUpEndorsementDetail> CarPickUpEndorsementDetails;
// 包车背书信息详情列表 - 必填
// Y表示必填项
private List<CarCharterEndorsementDetail> carCharterEndorsementDetails;
private List<CarCharterEndorsementDetail> CarCharterEndorsementDetails;
// 巴士背书信息详情列表 - 必填
// Y表示必填项
private List<BusEndorsementDetail> busEndorsementDetails;
private List<BusEndorsementDetail> BusEndorsementDetails;
// 出差计划背书信息详情列表 - 必填
// Y表示必填项
private List<TravelPlanEndorsementDetail> travelPlanEndorsementDetails;
private List<TravelPlanEndorsementDetail> TravelPlanEndorsementDetails;
// 有效期 - 非必填
// 有效期格式为日期时间起始时间从2017-01-01开始
private String expiredTime;
private String ExpiredTime;
// 认证信息 - 非必填
// 携程分配给客户公司具体见下表描述
private Authentication auth;
private Authentication Auth;
// 成本中心等扩展字段列表非必填如无该需求则不需要传
// Y表示必填项
private List<ExtendField> extendFieldList;
// Y表示必填项R
private List<ExtendField> ExtendFieldList;
// 备注 - 必填
// Y表示必填项
private String remark;
private String Remark;
// 职级信息 - 非必填
// 职级信息仅限于职级信息的前20
private RankInfo rankInfo;
private RankInfo RankInfo;
public ApprovalRequest(String approvalNumber, String employeeID, RankInfo rankInfo) {
this.approvalNumber = approvalNumber;
this.employeeID = employeeID;
this.rankInfo = rankInfo;
this.ApprovalNumber = approvalNumber;
this.EmployeeID = employeeID;
this.RankInfo = rankInfo;
}
public static ApprovalRequest buildApproval(String employeeID, String approvalNumber, RankInfo rankInfo) {
return new ApprovalRequest(employeeID, approvalNumber, rankInfo);
public static ApprovalRequest buildApproval(String approvalNumber, String employeeID, RankInfo rankInfo) {
return new ApprovalRequest(approvalNumber,employeeID, rankInfo);
}
public ApprovalRequest withAir(List<FlightEndorsementDetail> flightEndorsementDetails) {
this.flightEndorsementDetails = flightEndorsementDetails;
this.FlightEndorsementDetails = flightEndorsementDetails;
return this;
}
public ApprovalRequest withTrain(List<HotelEndorsementDetail> hotelEndorsementDetails) {
this.hotelEndorsementDetails = hotelEndorsementDetails;
public ApprovalRequest withTrain(List<TrainEndorsementDetail> trainEndorsementDetails) {
this.TrainEndorsementDetails = trainEndorsementDetails;
return this;
}
public ApprovalRequest withBus(List<BusEndorsementDetail> busEndorsementDetails) {
this.busEndorsementDetails = busEndorsementDetails;
this.BusEndorsementDetails = busEndorsementDetails;
return this;
}
public ApprovalRequest withPickCar(List<CarPickUpEndorsementDetail> carPickUpEndorsementDetails) {
this.carPickUpEndorsementDetails = carPickUpEndorsementDetails;
this.CarPickUpEndorsementDetails = carPickUpEndorsementDetails;
return this;
}
public ApprovalRequest withQuickCar(List<CarQuickEndorsementDetail> carQuickEndorsementDetails) {
this.carQuickEndorsementDetails = carQuickEndorsementDetails;
this.CarQuickEndorsementDetails = carQuickEndorsementDetails;
return this;
}
public ApprovalRequest withHotel(List<HotelEndorsementDetail> hotelEndorsementDetails) {
this.hotelEndorsementDetails = hotelEndorsementDetails;
this.HotelEndorsementDetails = hotelEndorsementDetails;
return this;
}
}

View File

@ -0,0 +1,8 @@
package com.chint.interfaces.rest.ctrip.dto.approval;
import lombok.Data;
@Data
public class ApprovalRequestOut {
private ApprovalRequest request;
}

View File

@ -0,0 +1,8 @@
package com.chint.interfaces.rest.ctrip.dto.approval;
import lombok.Data;
@Data
public class ApprovalResponse {
private ResponseStatus Status;
}

View File

@ -5,6 +5,8 @@ import lombok.Data;
@Data
public class ApprovalResult {
private ResponseStatus Status;
private ApprovalResponse SetApprovalResult;
}

View File

@ -1,100 +1,131 @@
package com.chint.interfaces.rest.ctrip.dto.approval.air;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType;
import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Data
public class FlightEndorsementDetail {
// 订票类型列表 - 1张, 2张, 3张, 超过3张
private List<String> bookingTypeList;
private List<String> BookingTypeList;
// 订单ID列表 - 最多20个
private List<String> orderIDList;
private List<String> OrderIDList;
// 航空公司名称 - 不可为空字符串
private String airline;
private String Airline;
// 货币类型 - 默认CNY
private CurrencyType currency;
private CurrencyType Currency;
// 航班类型 - 单程(1) or 往返(2)
private FlightWayType flightWay;
private FlightWayType FlightWay;
// 起飞日期开始时间 - 格式: yyyy-MM-dd
private String departDateBegin;
private String DepartDateBegin;
// 起飞日期结束时间 - 格式: yyyy-MM-dd
private String departDateEnd;
private String DepartDateEnd;
// 返回日期开始时间 - 格式: yyyy-MM-dd
private String returnDateBegin;
private String ReturnDateBegin;
// 返回日期结束时间 - 格式: yyyy-MM-dd
private String returnDateEnd;
private String ReturnDateEnd;
// 起飞时间开始时间 - 格式: HH:mm
private String takeOffBeginTime;
private String TakeOffBeginTime;
// 起飞时间结束时间 - 格式: HH:mm
private String takeOffEndTime;
private String TakeOffEndTime;
// 到达时间开始时间 - 格式: HH:mm
private String arrivalBeginTime;
private String ArrivalBeginTime;
// 到达时间结束时间 - 格式: HH:mm
private String arrivalEndTime;
private String ArrivalEndTime;
// 折扣率 - 0.1到1.0, 0代表无折扣
private float discount;
private float Discount;
// 出发国家ID列表 - 最多1000个
private List<String> departCountryIds;
private List<String> DepartCountryIds;
// 出发国家代码列表 - 最多1000个
private List<String> departCountryCodes;
private List<String> DepartCountryCodes;
// 出发城市代码列表 - 最多1000个
private List<String> departCityCodes;
private List<String> DepartCityCodes;
// 到达国家ID列表 - 最多1000个
private List<String> arrivalCountryIds;
private List<String> ArrivalCountryIds;
// 到达城市代码列表 - 最多1000个
private List<String> arrivalCityCodes;
private List<String> ArrivalCityCodes;
// 出发城市ID列表 - 最多1000个
private List<String> departCityIds;
private List<String> DepartCityIds;
// 到达城市ID列表 - 最多1000个
private List<String> arrivalCityIds;
private List<String> ArrivalCityIds;
// 乘客列表 - 无数量限制
private List<PassengerDetail> passengerList;
private List<PassengerDetail> PassengerList;
// 价格 - 可为负数, 默认为0
private float price;
private float Price;
// 产品类型 - 1代表经济舱, 2代表商务舱
private ProductTypeEnum productType;
private ProductTypeEnum ProductType;
// 座位等级 - 经济舱(3), 商务舱(2), 头等舱(1)
private SeatClassType seatClass;
private SeatClassType SeatClass;
// 跳过的字段位 - 用于标记不包含的字段
private long skipFields;
private long SkipFields;
// 旅客数量 - 无限制
private int travelerCount;
private int TravelerCount;
// 总旅客数量 - 用于统计
private int totalTravelerCount;
private int TotalTravelerCount;
// 预验证字段位 - 用于标记需要预验证的字段
private long preVerifyFields;
private long PreVerifyFields;
// Getters and setters...
public static FlightEndorsementDetail of(List<String> DepartCityIds , List<String> ArrivalCityIds) {
FlightEndorsementDetail flightEndorsementDetail = new FlightEndorsementDetail();
flightEndorsementDetail.setDepartCountryIds(DepartCityIds);
flightEndorsementDetail.setArrivalCityIds(ArrivalCityIds);
return flightEndorsementDetail;
}
public FlightEndorsementDetail passenger(PassengerDetail passengerDetail) {
if (this.PassengerList == null) {
this.PassengerList = new ArrayList<>();
}
this.PassengerList.add(passengerDetail);
return this;
}
public FlightEndorsementDetail starTime(LocalDateTime startTime) {
this.DepartDateBegin = DateTimeUtil.timeToStr(startTime);
this.ReturnDateBegin = DateTimeUtil.timeToStr(startTime);
return this;
}
public FlightEndorsementDetail endTime(LocalDateTime endTime) {
this.DepartDateEnd = DateTimeUtil.timeToStr(endTime);
this.ReturnDateEnd = DateTimeUtil.timeToStr(endTime);
return this;
}
}

View File

@ -14,64 +14,64 @@ import java.util.List;
public class HotelEndorsementDetail {
// 产品类型
private HotelProductTypeEnum productType;
private HotelProductTypeEnum ProductType;
// 入住开始日期 - 格式: yyyy-MM-dd
private String checkInDateBegin;
private String CheckInDateBegin;
// 入住结束日期 - 格式: yyyy-MM-dd
private String checkInDateEnd;
private String CheckInDateEnd;
// 离店开始日期 - 格式: yyyy-MM-dd
private String checkOutDateBegin;
private String CheckOutDateBegin;
// 离店结束日期 - 格式: yyyy-MM-dd
private String checkOutDateEnd;
private String CheckOutDateEnd;
// 乘客列表
private List<PassengerDetail> passengerList;
private List<PassengerDetail> PassengerList;
// 入住国家ID列表
private List<String> checkInCountryIds;
private List<String> CheckInCountryIds;
// 入住国家代码列表
private List<String> checkInCountryCodes;
private List<String> CheckInCountryCodes;
// 入住城市代码列表
private List<String> checkInCityCodes;
private List<String> CheckInCityCodes;
// 最高价格
private String maxPrice;
private String MaxPrice;
// 最低价格
private String minPrice;
private String MinPrice;
// 货币类型 - 默认CNY
private CurrencyType currency;
private CurrencyType Currency;
// 最大星级
private String maxStarRating;
private String MaxStarRating;
// 最小星级
private String minStarRating;
private String MinStarRating;
// 平均价格
private String averagePrice;
private String AveragePrice;
// 房间数量
private int roomCount;
private int RoomCount;
// 跳过的字段位 - 用于标记不包含的字段
private long skipFields;
private long SkipFields;
// 总房晚数
private int totalRoomNightCount;
private int TotalRoomNightCount;
// 房晚价格
private String roomNightPrice;
private String RoomNightPrice;
// 预验证字段位 - 用于标记需要预验证的字段
private long preVerifyFields;
private long PreVerifyFields;
// Getters and setters...
@ -82,22 +82,22 @@ public class HotelEndorsementDetail {
}
public HotelEndorsementDetail passenger(PassengerDetail passengerDetail) {
if (this.passengerList == null) {
this.passengerList = new ArrayList<>();
if (this.PassengerList == null) {
this.PassengerList = new ArrayList<>();
}
this.passengerList.add(passengerDetail);
this.PassengerList.add(passengerDetail);
return this;
}
public HotelEndorsementDetail starTime(LocalDateTime startTime) {
this.checkInDateBegin = DateTimeUtil.timeToStr(startTime);
this.checkOutDateBegin = DateTimeUtil.timeToStr(startTime);
this.CheckInDateBegin = DateTimeUtil.timeToStr(startTime);
this.CheckOutDateBegin = DateTimeUtil.timeToStr(startTime);
return this;
}
public HotelEndorsementDetail endTime(LocalDateTime endTime) {
this.checkInDateEnd = DateTimeUtil.timeToStr(endTime);
this.checkOutDateEnd = DateTimeUtil.timeToStr(endTime);
this.CheckInDateEnd = DateTimeUtil.timeToStr(endTime);
this.CheckOutDateEnd = DateTimeUtil.timeToStr(endTime);
return this;
}
}

View File

@ -1,42 +1,70 @@
package com.chint.interfaces.rest.ctrip.dto.approval.quick;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType;
import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Data
public class CarQuickEndorsementDetail {
// 产品类型
private int productType;
private int ProductType;
// 乘客列表, 最多100名
private List<PassengerDetail> passengerList;
private List<PassengerDetail> PassengerList;
// 城市代码
private String cities;
private String Cities;
// 公司地址列表
private List<CompanyAddressDetail> companyAddressList;
private List<CompanyAddressDetail> CompanyAddressList;
// 到达地址列表
private List<CompanyAddressDetail> arrivalAddressList;
private List<CompanyAddressDetail> ArrivalAddressList;
// 开始使用日期
private String beginUseDate;
private String BeginUseDate;
// 结束使用日期
private String endUseDate;
private String EndUseDate;
// 使用时间列表
private List<UseTimeDetail> useTimeList;
private List<UseTimeDetail> UseTimeList;
// 货币类型, 默认CNY
private CurrencyType currency;
private CurrencyType Currency;
// 价格默认为0
private float price;
private float Price;
// 车辆组
private String vehicleGroup;
private String VehicleGroup;
// 有效性金额
private int effectivenessAmount;
private int EffectivenessAmount;
// 跳过的字段位
private long skipFields;
private long SkipFields;
// 到达城市代码
private String arrivalCities;
private String ArrivalCities;
// Getters and setters...
public static CarQuickEndorsementDetail of(List<String> cities) {
CarQuickEndorsementDetail carQuickEndorsementDetail = new CarQuickEndorsementDetail();
carQuickEndorsementDetail.setArrivalCities(String.join(",",cities));
return carQuickEndorsementDetail;
}
public CarQuickEndorsementDetail passenger(PassengerDetail passengerDetail) {
if (this.PassengerList == null) {
this.PassengerList = new ArrayList<>();
}
this.PassengerList.add(passengerDetail);
return this;
}
public CarQuickEndorsementDetail starTime(LocalDateTime startTime) {
this.BeginUseDate = DateTimeUtil.timeToStr(startTime);
return this;
}
public CarQuickEndorsementDetail endTime(LocalDateTime endTime) {
this.EndUseDate = DateTimeUtil.timeToStr(endTime);
return this;
}
}

View File

@ -1,69 +1,103 @@
package com.chint.interfaces.rest.ctrip.dto.approval.train;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.interfaces.rest.ctrip.dto.approval.CurrencyType;
import com.chint.interfaces.rest.ctrip.dto.approval.PassengerDetail;
import com.chint.interfaces.rest.ctrip.dto.approval.air.FlightEndorsementDetail;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
// TrainEndorsementDetail class definition
@Data
public class TrainEndorsementDetail {
// 火车产品类型
private TrainProductTypeEnum productType;
private TrainProductTypeEnum ProductType;
// 订票类型列表 - 1张, 2张, 3张, 超过3张
private List<String> bookingTypeList;
private List<String> BookingTypeList;
// 订单ID列表
private List<String> orderIDList;
private List<String> OrderIDList;
// 行程类型 - 单程(1) or 往返(2)
private TripTypeEnum tripType;
private TripTypeEnum TripType;
// 出发日期开始 - 格式: yyyy-MM-dd
private String departDateBegin;
private String DepartDateBegin;
// 出发日期结束 - 格式: yyyy-MM-dd
private String departDateEnd;
private String DepartDateEnd;
// 返回日期开始 - 格式: yyyy-MM-dd
private String returnDateBegin;
private String ReturnDateBegin;
// 返回日期结束 - 格式: yyyy-MM-dd
private String returnDateEnd;
private String ReturnDateEnd;
// 乘客列表 - 无限制
private List<PassengerDetail> passengerList;
private List<PassengerDetail> PassengerList;
// 到达城市代码列表 - 最多1000个
private List<String> arrivalCityCodes;
private List<String> ArrivalCityCodes;
// 出发城市代码列表 - 最多1000个
private List<String> departCityCodes;
private List<String> DepartCityCodes;
// 价格 - 可为负数, 默认为0
private String price;
private String Price;
// 货币类型 - 默认CNY
private CurrencyType currency;
private CurrencyType Currency;
// 座位类型
private List<SeatTypeEnum> seatType;
private List<SeatTypeEnum> SeatType;
// 跳过的字段位 - 用于标记不包含的字段
private long skipFields;
private long SkipFields;
// 旅客数量 - 默认为0
private int travelerCount;
private int TravelerCount;
// 预验证字段位 - 用于标记需要预验证的字段
private long preVerifyFields;
private long PreVerifyFields;
// 列车车次列表 - 如G, D, C, Z, T, K等
private List<String> trainVehicleTypeList;
private List<String> TrainVehicleTypeList;
// 总旅客数量 - 用于统计
private int totalTravelerCount;
private int TotalTravelerCount;
// Getters and setters...
public static TrainEndorsementDetail of(List<String> DepartCityCodes , List<String> ArrivalCityCodes) {
TrainEndorsementDetail trainEndorsementDetail = new TrainEndorsementDetail();
trainEndorsementDetail.setDepartCityCodes(DepartCityCodes);
trainEndorsementDetail.setArrivalCityCodes(ArrivalCityCodes);
return trainEndorsementDetail;
}
public TrainEndorsementDetail passenger(PassengerDetail passengerDetail) {
if (this.PassengerList == null) {
this.PassengerList = new ArrayList<>();
}
this.PassengerList.add(passengerDetail);
return this;
}
public TrainEndorsementDetail starTime(LocalDateTime startTime) {
this.DepartDateBegin = DateTimeUtil.timeToStr(startTime);
this.ReturnDateBegin = DateTimeUtil.timeToStr(startTime);
return this;
}
public TrainEndorsementDetail endTime(LocalDateTime endTime) {
this.DepartDateEnd = DateTimeUtil.timeToStr(endTime);
this.ReturnDateEnd = DateTimeUtil.timeToStr(endTime);
return this;
}
}

View File

@ -1,4 +0,0 @@
package com.chint.interfaces.rest.ctrip.dto.search;
public class CarOrderInfoEntity {
}

View File

@ -1,4 +0,0 @@
package com.chint.interfaces.rest.ctrip.dto.search;
public class FlightOrderInfoEntity {
}

View File

@ -1,7 +0,0 @@
package com.chint.interfaces.rest.ctrip.dto.search;
import lombok.Data;
@Data
public class HotelOrderInfoEntity {
}

View File

@ -1,5 +1,9 @@
package com.chint.interfaces.rest.ctrip.dto.search;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.train.TrainOrderInfoEntity;
import lombok.Data;
import java.util.List;
@ -8,23 +12,23 @@ import java.util.List;
public class ItineraryEntity {
// 行程单号
private String journeyNO; // 行程单号
private String JourneyNO; // 行程单号
// 酒店订单信息列表
private List<HotelOrderInfoEntity> hotelOrderInfoList; // 酒店订单信息列表
private List<HotelOrderInfoEntity> HotelOrderInfoList; // 酒店订单信息列表
// 航班订单信息列表
private List<FlightOrderInfoEntity> flightOrderInfoList; // 航班订单信息列表
private List<FlightOrderInfoEntity> FlightOrderInfoList; // 航班订单信息列表
// 火车票订单信息列表
private List<TrainOrderInfoEntity> trainOrderInfoList; // 火车票订单信息列表
private List<TrainOrderInfoEntity> TrainOrderInfoList; // 火车票订单信息列表
// 租车订单信息列表
private List<CarOrderInfoEntity> carOrderInfoList; // 租车订单信息列表
private List<CarOrderInfoEntity> CarOrderInfoList; // 租车订单信息列表
// 快捷租车订单信息列表
private List<CarQuickOrderInfoEntity> carQuickOrderInfoList; // 快捷租车订单信息列表
private List<CarQuickOrderInfoEntity> CarQuickOrderInfoList; // 快捷租车订单信息列表
// 接送机租车订单信息列表
private List<DomPickUpCarOrderInfoEntity> domPickUpCarOrderInfoList; // 接送机租车订单信息列表
private List<DomPickUpCarOrderInfoEntity> DomPickUpCarOrderInfoList; // 接送机租车订单信息列表
// 包车租车订单信息列表
private List<DomCharterCarOrderInfoEntity> domCharterCarOrderInfoList; // 包车租车订单信息列表
private List<DomCharterCarOrderInfoEntity> DomCharterCarOrderInfoList; // 包车租车订单信息列表
// 国际火车票订单信息列表
private List<IntlTrainOrderInfoEntity> intlTrainOrderInfoList; // 国际火车票订单信息列表
private List<IntlTrainOrderInfoEntity> IntlTrainOrderInfoList; // 国际火车票订单信息列表
// Getters and Setters...
}

View File

@ -34,5 +34,9 @@ public class SearchOrderRequest {
private String htlSearchTypeExtend; // 酒店查询类型扩展
private String carSearchTypeExtend; // 租车查询类型扩展
public static SearchRequestBuilder builder() {
return new SearchRequestBuilder();
}
// Getters and Setters...
}

View File

@ -9,9 +9,9 @@ import java.util.List;
public class SearchOrderResponse {
// 响应状态
private ResponseStatus status; // 响应状态
private ResponseStatus Status; // 响应状态
// 行程单列表
private List<ItineraryEntity> itineraryList; // 行程单列表
private List<ItineraryEntity> ItineraryList; // 行程单列表
// Getters and Setters...
}

View File

@ -0,0 +1,46 @@
package com.chint.interfaces.rest.ctrip.dto.search;
import com.chint.interfaces.rest.ctrip.dto.Authentication;
public class SearchRequestBuilder {
private SearchOrderRequest request = new SearchOrderRequest();
public SearchRequestBuilder language(String language){
request.setLanguage(language);
return this;
}
public SearchRequestBuilder journeyNo(String journeyNo){
request.setJourneyNo(journeyNo);
return this;
}
public SearchOrderRequest done() {
return request;
}
public AuthInfoBuilder authInfo() {
return new AuthInfoBuilder(this, request);
}
public static class AuthInfoBuilder {
private final SearchRequestBuilder parentBuilder;
private final SearchOrderRequest request;
public AuthInfoBuilder(SearchRequestBuilder parentBuilder, SearchOrderRequest request) {
this.parentBuilder = parentBuilder;
this.request = request;
}
public AuthInfoBuilder details(String appKey, String accessToken) {
Authentication authInfo = new Authentication(appKey, accessToken); // Construct AuthInfo with parameters
request.setAuth(authInfo);
return this;
}
public SearchRequestBuilder done() {
return parentBuilder;
}
}
}

View File

@ -1,4 +0,0 @@
package com.chint.interfaces.rest.ctrip.dto.search;
public class TrainOrderInfoEntity {
}

View File

@ -0,0 +1,19 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单基本信息类
@Data
class BasicInfo {
private long orderId; // 订单ID
private double estimateAmount; // 预估金额
private double orderAmount; // 订单金额
private double dealAmount; // 成交金额
private String orderStatus; // 订单状态
private String authorizeStatus; // 授权状态
private String paymentStatus; // 支付状态
private String paymentType; // 支付类型
private String feeType; // 费用类型
private String UID; // 用户ID
// Other fields and getters/setters
}

View File

@ -0,0 +1,21 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
import java.util.List;
@Data
public class CarOrderInfoEntity {
private BasicInfo basicInfo; // 基本信息
private OrderProduct orderProduct; // 订单产品
private List<OrderFee> orderFeeList; // 订单费用列表
private OrderInsurance orderInsurance; // 订单保险信息
private OrderInvoice orderInvoice; // 订单发票信息
private PassengerInfo passengerInfo; // 乘客信息
private List<PaymentInfo> paymentInfoList; // 支付信息列表
private List<PaymentSettlement> paymentSettlementList; // 支付结算列表
private List<ChoosedVehicle> choosedVehicleList; // 选择的车辆列表
private OrderConfigInfo orderConfigInfo; // 订单配置信息
private List<PaymentSupply> paymentSupplyList; // 支付供应列表
private OrderPaymentInfo orderPaymentInfo; // 订单支付信息
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 选择的车辆信息类
@Data
class ChoosedVehicle {
private double estimateAmount; // 预估金额
private int vehicleId; // 车辆ID
private String vehicleName; // 车辆名称
// Other fields and getters/setters
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 出发地址信息类
@Data
class DepartAddress {
private String address; // 地址
private String addressDetail; // 地址详情
private String cityId; // 城市ID
// Other fields and getters/setters
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单配置信息类
@Data
class OrderConfigInfo {
private String sceneName; // 场景名称
private String standardName; // 标准名称
private String carTravelSendType; // 汽车出行发送类型
private String currency; // 货币类型
// Other fields and getters/setters
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单费用信息类
@Data
class OrderFee {
private String costScene; // 费用场景
private String feeTypeCode; // 费用类型编码
private String feeName; // 费用名称
private double amount; // 金额
private String orderFeeId; // 订单费用ID
// Other fields and getters/setters
}

View File

@ -0,0 +1,11 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单保险信息类
@Data
class OrderInsurance {
private String productCode; // 产品编码
private String companyId; // 公司ID
// Other fields and getters/setters
}

View File

@ -0,0 +1,11 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单发票信息类
@Data
class OrderInvoice {
private String invoiceId; // 发票ID
private String customerTaxNumber; // 客户税号
// Other fields and getters/setters
}

View File

@ -0,0 +1,7 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
@Data
public class OrderPaymentInfo {
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 订单产品信息类
@Data
class OrderProduct {
private String vendorOrderId; // 供应商订单ID
private int bookingType; // 预订类型
private String useTime; // 使用时间
private DepartAddress departAddress; // 出发地址信息
private PassengerPosition passengerPosition; // 乘客位置信息
// Other fields and getters/setters
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 乘客信息类
@Data
class PassengerInfo {
private String corpUserId; // 公司用户ID
private String employeeId; // 员工ID
private String intlCode; // 国际代码
private String passengerId; // 乘客ID
// Other fields and getters/setters
}

View File

@ -0,0 +1,11 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 乘客位置信息类
@Data
class PassengerPosition {
private String latitude; // 纬度
private String longitude; // 经度
// Other fields and getters/setters
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 支付信息类
@Data
class PaymentInfo {
private double amount; // 金额
private String billNo; // 账单号
private String paidTime; // 支付时间
private String paymentCategory; // 支付类别
// Other fields and getters/setters
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 支付结算信息类
@Data
class PaymentSettlement {
private double amount; // 金额
private String feeTypeCode; // 费用类型编码
private String feeTypeName; // 费用类型名称
// Other fields and getters/setters
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import lombok.Data;
// 支付供应信息类
@Data
class PaymentSupply {
private String paymentSupplyId; // 支付供应ID
private long orderID; // 订单ID
private double serviceAmount; // 服务金额
// Other fields and getters/setters
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class BasicInfo {
private String orderID;
private String tripID;
private String orderStatus;
private String orderStatusCode;
private String UID;
// Other fields and getters/setters
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class DeliveryInfo {
private String deliveryInfo;
private String contactPhone;
private String contactMobile;
private String contactName;
// Other fields and getters/setters
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class FlightInfo {
private String sequence;
private String flight;
private String airLineCode;
private String airLineName;
// Other fields and getters/setters
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class FlightOrderFeeDetail {
private String transactionType;
private String payType;
private int transactionAmount;
private String payCurrency;
// Other fields and getters/setters
}

View File

@ -0,0 +1,15 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
import java.util.List;
@Data
public class FlightOrderInfoEntity {
private BasicInfo basicInfo;
private DeliveryInfo deliveryInfo;
private List<FlightInfo> flightInfo;
private List<PassengerInfo> passengerInfo;
private List<FlightOrderFeeDetail> flightOrderFeeDetailList;
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class PassengerBasic {
private String corpEid;
private String passengerName;
private String passengerNamePY;
private String nationalityCode;
private String cardTypeName;
// Other fields and getters/setters
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
import java.util.List;
@Data
class PassengerInfo {
private PassengerBasic passengerBasic;
private List<SequenceInfo> sequenceInfo;
// Getters and setters
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
import java.util.List;
@Data
class SequenceInfo {
private int sequence;
private List<TicketInfo> ticketInfo;
// Getters and setters
}

View File

@ -0,0 +1,13 @@
package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class TicketInfo {
private String airLineCode;
private String ticketNo;
private String ticketNoSignCode;
private String status;
// Other fields and getters/setters
}

View File

@ -0,0 +1,29 @@
package com.chint.interfaces.rest.ctrip.dto.search.hotel;
import lombok.Data;
@Data
public class ClientInfo {
private int RoomIndex; // 房间索引
private String ClientName; // 客户名
private String EmployeeID; // 员工ID
private String CostCenter1; // 成本中心1
private String CostCenter2; // 成本中心2
private String CostCenter3; // 成本中心3
private String CostCenter4; // 成本中心4
private String CostCenter5; // 成本中心5
private String CostCenter6; // 成本中心6
private String Dept1; // 部门1
private String Dept2; // 部门2
private String Dept3; // 部门3
private String Dept4; // 部门4
// Dept5至Dept10可以根据实际需要添加
private String CheckinTime; // 入住时间
private String CheckoutTime; // 离店时间
private String ActualDepartureTime; // 实际离开时间
private double ShareOrderAmount; // 分摊订单金额
// ClientPreApprovalNo字段的具体类型根据需要确定如果是一个复杂结构可能需要定义一个新的类
private double Price; // 价格
private String Star; // 星级
private double ActualUpperAmount; // 实际上限金额
}

View File

@ -0,0 +1,71 @@
package com.chint.interfaces.rest.ctrip.dto.search.hotel;
import lombok.Data;
import java.util.List;
@Data
public class HotelOrderInfoEntity {
private String OrderId; // 订单ID
private String TripId; // 旅行ID
private String Uid; // 用户ID
private String PreEmployeeId; // 预订员工ID
private String PreEmployeeName; // 预订员工姓名
private String Currency; // 货币类型
private String Amount; // 订单总金额
private String AmountRMB; // 订单金额人民币
private String CustomPayAmount; // 自定义支付金额
private String SettlementAmount; // 结算金额
private String PostAmount; // 邮寄金额
private String PayType; // 支付类型
private String CustomPayCurrency; // 自定义支付货币
private String CustomPayExchange; // 自定义支付汇率
private String SettlementCurrency; // 结算货币
private String SettlementExchange; // 结算汇率
private String IsMixPayment; // 是否混合支付
private String SettlementACCNTAmt; // 结算账户金额
private String SettlementPersonAmt; // 结算个人金额
private String AddedFees; // 额外费用
private String FrontendServiceFee; // 前端服务费
private String HotelType; // 酒店类型
private String HotelName; // 酒店名称
private String HotelEnName; // 酒店英文名称
private String StarLicence; // 星级许可
private String Star; // 星级
private String CustomerEval; // 客户评价
private String Telephone; // 电话号码
private String Address; // 地址
private String StartTime; // 入住开始时间
private String EndTime; // 入住结束时间
private String ProvinceEname; // 省份英文名
private String CityID; // 城市ID
private String CityName; // 城市名称
private String CityEnName; // 城市英文名称
private String RoomName; // 房间名称
private String IsDomestic; // 是否国内
private String RoomType; // 房间类型
private String MealType; // 餐食类型
private String MasterHotelID; // 主酒店ID
private String DistrictID; // 区域ID
private String DistrictName; // 区域名称
private String OrderStatus; // 订单状态
private String OrderDetailStatus; // 订单详细状态
private String OrderDetailStatusName; // 订单详细状态名称
private String OrderDate; // 订单日期
private String LastCancelTime; // 最后取消时间
private String CancelTime; // 取消时间
private String CancelReasonCode; // 取消原因代码
private String CancelReasonDesc; // 取消原因描述
private String FundAccount; // 资金账户
private String SubAccount; // 子账户
private String BalanceType; // 余额类型
private String CorpPayType; // 公司支付类型
private String ContactEmail; // 联系人邮箱
private String ContactName; // 联系人姓名
private String ContactTel; // 联系人电话
private String HotelConfirmNo; // 酒店确认号
private String JourneyNo; // 旅程编号
private String CostCenter; // 成本中心
// 后续字段含义类似可根据实际情况添加注释
private List<ClientInfo> ClientInfo; // 客户信息列表
}

View File

@ -0,0 +1,17 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// AccountPaymentInfo内部类定义
@Data
public class AccountPaymentInfo {
private long DealID;
private int AccountID;
private int SubAccountID;
private String OrderID;
private double Amount;
private String Category;
private String DataChange_CreateTime;
private String TrainRelatedNo;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,25 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// AfterTakeTicket内部类定义
@Data
public class AfterTakeTicket {
private long AfterTakeTicketId;
private String CompanyId;
private String CompanyName;
private String ContactName;
private String ContactPhone;
private String CountryCode;
private String Address;
private String DeliverTime;
private String NoticeCtripTime;
private String CtripTakeTicketTime;
private String CtripDeliverTime;
private String TakeType;
private String TakeTicketStatus;
private String FailReason;
private String ExpressCompany;
private String ExpressNo;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
@Data
public class FundAccountDealInfo {
private double Amount;
private String Category;
private long DealID;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// OrderPayment内部类定义
@Data
public class OrderPayment {
private String PaymentType;
private String FeeCode;
private double FeeAmount;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,24 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// PassengerInfo内部类定义
@Data
public class PassengerInfo {
private long PassengerID;
private String PassengerName;
private String IdentityTypeName;
private String IdentityNo;
private String Birthday;
private String TicketTypeName;
private int InsuranceProductID;
private int PurchaseNumber;
private int TicketPresentNum;
private String CostCenter1;
private String CostCenter2;
private String CostCenter3;
private String CostCenter4;
private String EmployeeID;
private String CorpUserID;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// PaymentInfo内部类定义
@Data
public class PaymentInfo {
private double Amount;
private double ExchangeRate;
private String Currency;
private String DealType;
private String PayWayID;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,12 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
import java.util.List;
// SettlementInfo内部类定义
@Data
public class SettlementInfo {
private List<FundAccountDealInfo> FundAccountDealInfos;
private List<SettlementInfoDetail> SettlementInfos;
}

View File

@ -0,0 +1,23 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
@Data
public class SettlementInfoDetail {
private long OrderTicketID;
private long PassengerID;
private String PassengerName;
private double TicketPrice;
private double InsuranceFee;
private double ServiceFee;
private double RefundTicketFee;
private double DeliverFee;
private double PaperTicketFee;
private double ChangeServiceFee;
private double GrabServiceFee;
private long DealID;
private String TicketInfoID;
private double AfterTakeTicketFee;
private double PurchaseFee;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,21 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// TicketInfo内部类定义
@Data
public class TicketInfo {
private long TicketInfoID;
private String TrainName;
private String DepartureCityName;
private String DepartureDateTime;
private String ArrivalCityName;
private String ArrivalDateTime;
private String FirstSeatTypeName;
private double TicketPrice;
private String ElectronicOrderNo;
private double ServiceFee;
private String TicketEntrance;
private String DealID;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,44 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
@Data
public class TrainBasicInfo {
private String OrderID;
private String TripID;
private String EmployeeID;
private double OrderAmount;
private double DealAmount;
private int TotalQuantity;
private String Remark;
private boolean NeedInvoice;
private boolean IsIncludeInsuranceInvoice;
private int OrderTicketType;
private String OrderTicketTypeDesc;
private String OrderStatus;
private String OrderType;
private String OrderTypeDesc;
private double ServiceFee;
private String ContactName;
private String ContactMobile;
private String ContactEmail;
private String UID;
private String UserName;
private String RefundTicketStatus;
private String PaymentType;
private String DataChange_CreateTime;
private double DeliverFee;
private double PaperTicketFee;
private String AccountName;
private String ConfirmPerson;
private String AuditResult;
private String AuditResultDesc;
private String OrderStatusName;
private double ChangeServiceFee;
private String ServerFrom;
private String CorporationId;
private boolean NeedBigInvoice;
private String CountryCode;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,24 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
// CorpOrderInfo内部类定义
@Data
public class TrainCorpOrderInfo {
private String CorporationID;
private int AccountID;
private int SubAccountID;
private String CorpPayType;
private String CostCenter1;
private String CostCenter2;
private String CostCenter3;
private String CostCenter4;
private String JourneyReason;
private String Project;
private String JouneryID;
private String JourneyID;
private String CorporationName;
private String RcCodeID;
private String RcCodeName;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,15 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
@Data
public class TrainDeliveryInfo {
private String ShipAddress;
private String ShipAddressDetail;
private String ShipZipCode;
private String ShipReceiverMobile;
private String ShipReceiverName;
private String ShipReceiverTel;
private String CountryCode;
// 可以根据需要继续添加更多的字段
}

View File

@ -0,0 +1,26 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
import java.util.List;
@Data
public class TrainOrderInfoEntity {
private TrainBasicInfo BasicInfo;
private List<PassengerInfo> PassengerInfoList;
private List<TicketInfo> TicketInfoList;
private List<PaymentInfo> PaymentInfoList;
private SettlementInfo Settlementinfo;
private Object OrderRemarkInfoList; // 假设这是一个空类或未提供详细结构的字段
private Object InsuranceInfoList; // 假设这是一个空类或未提供详细结构的字段
private TrainDeliveryInfo DeliveryInfo;
private TrainCorpOrderInfo CorpOrderInfo;
private List<AccountPaymentInfo> AccountPaymentInfoList;
private TrainTicketDeliveryInfo TicketDeliveryInfo;
private Object OrderTicketInvoiceList; // 假设这是一个空类或未提供详细结构的字段
private Object InvoiceImageList; // 假设这是一个空类或未提供详细结构的字段
private Object ControlList; // 假设这是一个空类或未提供详细结构的字段
private List<OrderPayment> OrderPaymentList;
private List<AfterTakeTicket> AfterTakeTicketList;
}

View File

@ -0,0 +1,19 @@
package com.chint.interfaces.rest.ctrip.dto.search.train;
import lombok.Data;
@Data
public class TrainTicketDeliveryInfo {
private String OrderID;
private int AreaID;
private String Province;
private String City;
private String Area;
private String Address;
private String ShipmentCompany;
private String ShipmentNo;
private String DeliverStatus;
private String DeliverFailMessage;
private String CountryCode;
// 可以根据需要继续添加更多的字段
}

View File

@ -30,4 +30,16 @@ public class LYLoginRequest {
loginTokenData.setParam(loginParam);
return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class);
}
public LYRedirectUrlResponse loginPC(Integer entrance) {
User currentUser = BaseContext.getCurrentUser();
LoginTokenData loginTokenData = new LoginTokenData();
LoginParam loginParam = new LoginParam();
loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo()));
loginParam.setPlat(L_Y_PLAT_PC);
loginParam.setEntrance(entrance);
loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL);
loginTokenData.setParam(loginParam);
return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class);
}
}

View File

@ -40,13 +40,13 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private User loadSFAndRank(User user) {
List<UserDataDTO> loadSFInfo = loadSFInfo(user);
String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
String level = custManaLevel != null ? custManaLevel : "M0";
if (level.contains("R")) {
level = level.substring(0, level.length() - 3) + "M0";
}
TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
// List<UserDataDTO> loadSFInfo = loadSFInfo(user);
// String custManaLevel = loadSFInfo.get(0).getCust_manaLevel();
// String level = custManaLevel != null ? custManaLevel : "M0";
// if (level.contains("R")) {
// level = level.substring(0, level.length() - 3) + "M0";
// }
// TravelRankDTO loadTravelRank = loadTravelRank(new TravelRankParam(level));
// user.setRankCode(loadTravelRank.getLEVEL_MAPPING_CODE());
user.setRankCode("测试职级");
return user;

View File

@ -3,10 +3,7 @@ package com.chint;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
import com.chint.interfaces.rest.ctrip.CTripLocationHttpRequest;
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
import com.chint.interfaces.rest.ctrip.*;
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
import com.chint.interfaces.rest.ctrip.dto.estimate.request.FlightProductInfo;
import com.chint.interfaces.rest.ctrip.dto.estimate.request.RouteInfo;
@ -15,6 +12,7 @@ import com.chint.interfaces.rest.ctrip.dto.location.CTripCity;
import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
import com.chint.interfaces.rest.ctrip.dto.login.CTripAuthLoginParam;
import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
@ -38,6 +36,9 @@ public class CTripTest {
@Autowired
private CTripEstimateRequest estimateRequest;
@Autowired
private CTripOrderSearchRequest orderSearchRequest;
@Autowired
private CityRepository cityRepository;
@ -135,5 +136,11 @@ public class CTripTest {
BookingRelatedApiResponse estimate = estimateRequest.estimate(bookingRelatedApiRequest);
System.out.println(estimate);
}
@Test
void search(){
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrder("actual12345622");
System.out.println(response);
}
}

View File

@ -280,5 +280,11 @@ public class LYTest {
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
}
@Test
void loginLYPC() {
BaseContext.setCurrentUser(user);
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
}
}

View File

@ -2,6 +2,7 @@ package com.chint;
import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.user.UserHttpRequest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,4 +23,15 @@ class RouteApplicationTests {
userHttpRequest.loadUserInfo(user);
}
@Test
void loginSign(){
String sfno = "230615020";
String syscode = "abc";
String billcode = "12321466";
String sec = "Superdandan";
String timespan = "12312312312312";
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
System.out.println(s);
}
}