数据回推状
This commit is contained in:
parent
4ca03517c9
commit
b5d87bba90
|
@ -62,7 +62,7 @@ public class OrderApplicationService {
|
|||
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
order.reloadStatus();
|
||||
List<Leg> legs = processLegData(addLegData.getLegData(), order);
|
||||
List<Leg> legs = processLegData(addLegData.getLegData(), order);
|
||||
RouteOrder routeOrder = orderDomainService.saveOrder(order);
|
||||
legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue());
|
||||
return routeOrder; // 仅在所有操作完成后保存一次
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.chint.domain.aggregates.order.Leg;
|
|||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
|
@ -29,6 +30,9 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
@Autowired
|
||||
private OrderDomainService orderDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public boolean syncSupplierOrder(RouteOrder order) {
|
||||
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址
|
||||
|
@ -86,7 +90,54 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
//作废状态2
|
||||
order.setStatus(2);
|
||||
System.out.println("开始取消同程订单");
|
||||
return syncSupplierOrder(order);
|
||||
String supplierOrderSyncUrl = L_Y_BASE_URL + L_Y_ORDER_PATH;//请求地址
|
||||
//1.设置订单参数
|
||||
SupplierOrderParam param = new SupplierOrderParam();//参数
|
||||
param.setOutEmployeeIdType(0);//外部员工ID类型,默认为0
|
||||
// param.setOutTravelApplyNo(order.getApproveOrderNo().getActualOrderNo());//审批订单号
|
||||
param.setOutTravelApplyNo(order.getRouteOrderNo());//审批订单号
|
||||
param.setTravelApplyType(1); //差旅类型:1 普通差旅,2 福利差旅
|
||||
param.setStatus(order.getStatus());//状态:1通过,2作废
|
||||
//日期格式化
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
String applyTime = order.getCreateTime().format(formatter);
|
||||
String updateTime = order.getUpdateTime().format(formatter);
|
||||
param.setTravelApplyTime(applyTime);//开始(创建)时间
|
||||
param.setTravelUpdateTime(updateTime);//最后更新时间
|
||||
param.setOperationType(1);//1新增,2更新
|
||||
//获取用户信息
|
||||
// User user = BaseContext.getCurrentUser();
|
||||
User user = userRepository.findByUserEmployeeNo(order.getUserId());
|
||||
param.setOutEmployeeId(String.valueOf(order.getUserId()));//用户id
|
||||
param.setTravelDescription("同程订单");//描述信息
|
||||
param.setBookableProducts("1,3,5");//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
||||
//2.同程的行程节点集合
|
||||
List<AOSItem> aosItems = getAosItems(order);
|
||||
//3.差旅人信息
|
||||
List<AOSPerson> aosPeople = new ArrayList<>();
|
||||
AOSPerson aosPerson = new AOSPerson();
|
||||
aosPerson.setName(user.getName());//用户名
|
||||
aosPerson.setRelation(0);//0:内部员工,1:配偶,2:子女,3:父母,4:面试候选人,5:实习生,6:外部宾客
|
||||
aosPerson.setPassengerType(0);//0:成人, 1:儿童, 2:婴儿
|
||||
aosPerson.setOutEmployeeId(String.valueOf(order.getUserId()));//SF号(长工号)
|
||||
aosPeople.add(aosPerson);
|
||||
//4.前置差旅政策
|
||||
List<AOSPreTravelPolicy> aosPreTravelPolicies = new ArrayList<>();
|
||||
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
|
||||
aosPreTravelPolicy.setPolicyCode("");//一般指客户经理提供的差旅政策标题
|
||||
aosPreTravelPolicy.setProductTypeId(0);//产品ID 1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
|
||||
aosPreTravelPolicies.add(aosPreTravelPolicy);
|
||||
|
||||
param.setItemList(aosItems); // 同程节点内容
|
||||
param.setPersonList(aosPeople);// 同程信息(实际出行人)
|
||||
param.setPreTravelPolicyList(aosPreTravelPolicies);// 同程政策
|
||||
param.setApproveRuleType(0);//审批规则
|
||||
SupplierOrderSyncDto supplierOrderSyncDto = new SupplierOrderSyncDto();
|
||||
supplierOrderSyncDto.setParam(param);
|
||||
Result result = postRequest.post(supplierOrderSyncUrl, supplierOrderSyncDto, Result.class);
|
||||
System.out.println("result = " + result);
|
||||
String success = result.getSuccess();
|
||||
return Boolean.parseBoolean(success);
|
||||
}
|
||||
|
||||
//同程Leg集合解析
|
||||
|
|
|
@ -111,9 +111,11 @@ public class Constant {
|
|||
public static final String LEG_OTHER_AMOUNT_BUS_EN_NAME = "CoachBus";
|
||||
|
||||
//同程订单数据回推类型
|
||||
public static final int PRODUCT_TYPE_TRAIN = 0; //火车
|
||||
public static final int PRODUCT_TYPE_TRAIN = 5; //火车
|
||||
public static final int PRODUCT_TYPE_FLY = 1; //飞机
|
||||
public static final int PRODUCT_TYPE_TRAIN_CAR = 2; //用车
|
||||
public static final int PRODUCT_TYPE_COMMON = 0; //通用推送
|
||||
public static final int PRODUCT_TYPE_CHAILORDER = 4; //差旅单推送
|
||||
public static final int PRODUCT_TYPE_TRAIN_CAR = 6; //用车
|
||||
public static final int PRODUCT_TYPE_TRAIN_HOTEL = 3; //酒店
|
||||
|
||||
// 规划节点事件
|
||||
|
@ -228,6 +230,7 @@ public class Constant {
|
|||
|
||||
//同程
|
||||
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
||||
public static final String L_Y_STROKE_PUSH = "/api/TravelBizOrder/ExternalApproval";//行程推送外部审批
|
||||
public static final String L_Y_TOKEN_PATH = "/api/OAuth/v2/GetAccessToken";
|
||||
public static final String L_Y_ORDER_PATH = "/api/TravelApplyOrder/ApplyOrderSync";
|
||||
public static final String L_Y_USER_PATH = "/api/Employee/SyncEmployeeInfo";
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.location.CityEntity;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcCityRepository extends CrudRepository<CityEntity,Long> {
|
||||
CityEntity findByCityName(String cityName);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,4 +10,5 @@ import java.util.List;
|
|||
public interface JdbcRanksRepository extends CrudRepository<Ranks, Integer> {
|
||||
Ranks findByCompanyCodeAndRankName(String companyCode, String rankName);
|
||||
List<Ranks> findByCompanyCode(String companyCode);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,5 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
@NoArgsConstructor
|
||||
public class CTripNoteResponse {
|
||||
private String errorCode;
|
||||
|
||||
private String errorMessage;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.chint.interfaces.rest.ly.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Notification {
|
||||
public Object notifyData;
|
||||
public int notifyType; //推送类型
|
||||
public int subNotifyType; //推送子类型
|
||||
public long notifyTime; //推送时间戳
|
||||
public String sign; //推送签名
|
||||
public String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.interfaces.rest.ly.dto.carorderdatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.ticketpush.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -8,11 +9,6 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Notification {
|
||||
public class NotificationCar extends Notification {
|
||||
private NotifyData notifyData;
|
||||
private int notifyType; //推送类型
|
||||
private int subNotifyType; //推送子类型
|
||||
private long notifyTime; //推送时间戳
|
||||
private String sign; //推送签名
|
||||
private String soleKey; // 推送唯一秘钥
|
||||
}
|
|
@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
|
@ -12,4 +14,7 @@ public class NotifyData {
|
|||
private OrderDriver orderDriver;
|
||||
private OrderExtend orderExtend;
|
||||
private TravelData travelData;
|
||||
private List<PriceDetail> priceDetailList;
|
||||
private List<SubmitItem> submitItemList;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
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; // 推送唯一秘钥
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.interfaces.rest.ly.dto.flydatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationFly extends Notification{
|
||||
private OrderDetails orderDetails;
|
||||
}
|
|
@ -48,6 +48,9 @@ public class OrderDetails {
|
|||
private Integer refId;
|
||||
private boolean ruleViolate;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
private TravelData travelData;
|
||||
private List<Passenger> passengerList;
|
||||
private List<FlightSegment> flightSegmentList;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
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; // 推送唯一秘钥
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationHotel extends Notification {
|
||||
private OrderInfo orderInfo;
|
||||
}
|
|
@ -47,6 +47,14 @@ public class OrderInfo {
|
|||
private String supplierOrderCreateTime;
|
||||
private boolean ruleViolate;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
private HotelInfo hotelInfo;
|
||||
private DayPrice dayPrice;
|
||||
private List<String> residents;
|
||||
private List<Resident> residentList;
|
||||
private ContactPerson contactPerson;
|
||||
private RefundInfo refundInfo;
|
||||
private TravelData travelData;
|
||||
private List<RoomList> roomList;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.chint.interfaces.rest.ly.dto.strokepush;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StrokePushResult {
|
||||
private Boolean success;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
private String data;
|
||||
private String errorType;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.interfaces.rest.ly.dto.ticketpush;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
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; // 推送唯一秘钥
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.NotifyData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotificationTrain extends Notification {
|
||||
private NotifyData notifyData;
|
||||
}
|
|
@ -4,17 +4,47 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class NotifyData {
|
||||
private String orderNo;
|
||||
private String outOrderNo;
|
||||
private String issueTime;
|
||||
private String msgCode;
|
||||
private String msgInfo;
|
||||
private String fromStationCode;
|
||||
private String toStationCode;
|
||||
private String departureTime;
|
||||
private String arrivalTime;
|
||||
private String trainNo;
|
||||
private String ticketNo;
|
||||
private String orderAmount;
|
||||
private String fromStation;
|
||||
private String toStation;
|
||||
private String issueTime;
|
||||
private String mailCharge;
|
||||
private String msgDetail;
|
||||
private String ticketGate;
|
||||
private String fInfo;
|
||||
private List<Passenger> passengers;
|
||||
private boolean isSelfToProxy;
|
||||
private String isChangedOrder;
|
||||
private String originalOrderNo;
|
||||
private TravelData travelData;
|
||||
private String changedType;
|
||||
private String serviceCharge;
|
||||
private String changePriceDiff;
|
||||
private String expirationTime;
|
||||
private String directPayInfo;
|
||||
private int waitFlag;
|
||||
private int payType;
|
||||
private int isNeedTransfer;
|
||||
private String outEmployeeId;
|
||||
private String outEnterpriseId;
|
||||
private int bookingMethod;
|
||||
private boolean ruleViolate;
|
||||
private String foulReason;
|
||||
private String foulReasonCode;
|
||||
private String foulReasonNote;
|
||||
private RuleViolateDetail ruleViolateDetail;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
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...
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.chint.interfaces.rest.ly.dto.trainorderdatapushback;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class RuleViolateDetail {
|
||||
private String policyName;
|
||||
private List<Object> items;
|
||||
|
||||
// Getters and Setters...
|
||||
}
|
|
@ -4,13 +4,11 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.NotificationCar;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -34,8 +32,9 @@ public class CarBackController {
|
|||
|
||||
|
||||
@PostMapping("/back")
|
||||
public CTripNoteResponse carBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
|
||||
|
||||
public LYNoteResponse carBack(@RequestBody NotificationCar notificationCar) {
|
||||
String orderSerialNo = notificationCar.getNotifyData().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderSerialNo);
|
||||
String outEmployeeId = carDetailResponse.getData().getOutEmployeeId(); //外部员工id
|
||||
|
@ -48,13 +47,13 @@ public class CarBackController {
|
|||
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notificationCar.getSubNotifyType()));
|
||||
|
||||
command.eventType(carStatus(notification.getSubNotifyType()));
|
||||
command.eventType(carStatus(notificationCar.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
}
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
}
|
||||
public Integer carStatus(Integer status) {
|
||||
return switch (status) {
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.chint.interfaces.rest.ly.in;
|
||||
|
||||
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.NotificationCar;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.NotificationFly;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.NotificationHotel;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.NotificationTrain;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/public/common")
|
||||
public class CommonController {
|
||||
|
||||
@Autowired
|
||||
private CarBackController carBackController;
|
||||
|
||||
@Autowired
|
||||
private FlyBackController flyBackController;
|
||||
|
||||
@Autowired
|
||||
private HotelBackController hotelBackController;
|
||||
|
||||
@Autowired
|
||||
private TrainBackController trainBackController;
|
||||
@PostMapping("/back")
|
||||
public LYNoteResponse hotelBack(@RequestBody Notification notification) {
|
||||
int notifyType = notification.getNotifyType();
|
||||
return switch (notifyType){
|
||||
case 1 -> flyBackController.ticketBack((NotificationFly) notification);
|
||||
case 3 -> hotelBackController.hotelBack((NotificationHotel) notification);
|
||||
case 5 -> trainBackController.trainBack((NotificationTrain) notification);
|
||||
case 6-> carBackController.carBack((NotificationCar) notification);
|
||||
default -> new LYNoteResponse("200", "失败");
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -4,12 +4,10 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.NotificationFly;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -35,8 +33,8 @@ public class FlyBackController {
|
|||
|
||||
//机票订单数据回推
|
||||
@PostMapping("/back")
|
||||
public CTripNoteResponse ticketBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getOrderDetails().getOrderSerialNo();
|
||||
public LYNoteResponse ticketBack(@RequestBody NotificationFly notificationFly) {
|
||||
String orderSerialNo = notificationFly.getOrderDetails().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
FlightOrderDetail flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = flightOrderDetail.getData().getOrderDetails().getOutEmployeeId();//外部员工id
|
||||
|
@ -48,12 +46,12 @@ public class FlyBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
command.eventType(mapFlightStatus(notification.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notificationFly.getSubNotifyType()));
|
||||
command.eventType(mapFlightStatus(notificationFly.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
}
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
}
|
||||
|
||||
public Integer mapFlightStatus(Integer status) {
|
||||
|
|
|
@ -6,11 +6,10 @@ import com.chint.domain.value_object.SupplierCallbackData;
|
|||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.NotificationHotel;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -32,14 +31,12 @@ public class HotelBackController {
|
|||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
|
||||
@PostMapping("/back")
|
||||
public CTripNoteResponse hotelBack(@RequestBody Notification notification) {
|
||||
public LYNoteResponse hotelBack(@RequestBody NotificationHotel notificationHotel) {
|
||||
|
||||
String orderSerialNo = notification.getOrderInfo().getOrderSerialNo();
|
||||
String orderSerialNo = notificationHotel.getOrderInfo().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = hotelOrderDetail.getData().getOrderInfo().getOutEmployeeId();//外部员工id
|
||||
|
@ -52,13 +49,13 @@ public class HotelBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notificationHotel.getSubNotifyType()));
|
||||
//状态映射
|
||||
command.eventType(mapHotelState(notification.getSubNotifyType()));
|
||||
command.eventType(mapHotelState(notificationHotel.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
}
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ import com.chint.application.commands.OrderStatusChangeCommand;
|
|||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.Notification;
|
||||
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;
|
||||
|
@ -32,8 +31,8 @@ public class TrainBackController {
|
|||
private SupplierService supplierService;
|
||||
|
||||
@PostMapping("/back")
|
||||
public CTripNoteResponse trainBack(@RequestBody Notification notification) {
|
||||
String orderSerialNo = notification.getNotifyData().getOrderSerialNo();
|
||||
public LYNoteResponse trainBack(@RequestBody NotificationTrain notificationTrain) {
|
||||
String orderSerialNo = notificationTrain.getNotifyData().getOrderSerialNo();
|
||||
if (orderSerialNo != null) {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderSerialNo);
|
||||
String outEmployeeId = trainOrderDetail.getData().getOutEmployeeId();//外部员工id
|
||||
|
@ -45,13 +44,13 @@ public class TrainBackController {
|
|||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(serialNo)
|
||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||
command.eventType(mapTrainState(notification.getSubNotifyType()));
|
||||
.outStatus(String.valueOf(notificationTrain.getSubNotifyType()));
|
||||
command.eventType(mapTrainState(notificationTrain.getSubNotifyType()));
|
||||
command.sendToQueue();
|
||||
return new CTripNoteResponse("0", "成功收到消息");
|
||||
return new LYNoteResponse("100", "成功收到消息");
|
||||
}
|
||||
|
||||
return new CTripNoteResponse("1", "未收到消息");
|
||||
return new LYNoteResponse("200", "未收到消息");
|
||||
}
|
||||
public Integer mapTrainState(Integer status) {
|
||||
return switch (status) {
|
||||
|
|
Loading…
Reference in New Issue