diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index c1e0b17b..f6458b2b 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -62,7 +62,7 @@ public class OrderApplicationService { RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId())) .orElseThrow(() -> new NotFoundException(NOT_FOUND)); order.reloadStatus(); - List legs = processLegData(addLegData.getLegData(), order); + List legs = processLegData(addLegData.getLegData(), order); RouteOrder routeOrder = orderDomainService.saveOrder(order); legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); return routeOrder; // 仅在所有操作完成后保存一次 diff --git a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java index 388b022e..3be47e91 100644 --- a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java @@ -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 aosItems = getAosItems(order); + //3.差旅人信息 + List 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 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集合解析 diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index ce920a17..bc1fef19 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -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"; diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCityRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCityRepository.java index 3e15f9e2..0ecd4b1b 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCityRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCityRepository.java @@ -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 findByCityName(String cityName); + } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRanksRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRanksRepository.java index cf370da2..c914c056 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRanksRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRanksRepository.java @@ -10,4 +10,5 @@ import java.util.List; public interface JdbcRanksRepository extends CrudRepository { Ranks findByCompanyCodeAndRankName(String companyCode, String rankName); List findByCompanyCode(String companyCode); + } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/CTripNoteResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/CTripNoteResponse.java index b330b710..6a5701f6 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/CTripNoteResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/put/CTripNoteResponse.java @@ -10,6 +10,5 @@ import org.springframework.web.bind.annotation.RequestMapping; @NoArgsConstructor public class CTripNoteResponse { private String errorCode; - private String errorMessage; } diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java b/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java new file mode 100644 index 00000000..00da6864 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/Notification.java b/src/main/java/com/chint/interfaces/rest/ly/dto/Notification.java new file mode 100644 index 00000000..a4198747 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/Notification.java @@ -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; // 推送唯一秘钥 +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/Notification.java b/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotificationCar.java similarity index 53% rename from src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/Notification.java rename to src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotificationCar.java index e36bacd5..8d2ea363 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/Notification.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotificationCar.java @@ -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; // 推送唯一秘钥 } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotifyData.java b/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotifyData.java index 70deb56a..4d75db76 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotifyData.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/carorderdatapushback/NotifyData.java @@ -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 priceDetailList; + private List submitItemList; + } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/Notification.java b/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/Notification.java deleted file mode 100644 index 56ef12e5..00000000 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/Notification.java +++ /dev/null @@ -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; // 推送唯一秘钥 -} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/NotificationFly.java b/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/NotificationFly.java new file mode 100644 index 00000000..6b20579b --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/NotificationFly.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/OrderDetails.java b/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/OrderDetails.java index 5c97d5e0..fe625484 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/OrderDetails.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/flydatapushback/OrderDetails.java @@ -48,6 +48,9 @@ public class OrderDetails { private Integer refId; private boolean ruleViolate; private RuleViolateDetail ruleViolateDetail; + private TravelData travelData; + private List passengerList; + private List flightSegmentList; private String foulReason; private String foulReasonCode; private String foulReasonNote; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/Notification.java b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/Notification.java deleted file mode 100644 index 15baa8bf..00000000 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/Notification.java +++ /dev/null @@ -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; // 推送唯一秘钥 -} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/NotificationHotel.java b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/NotificationHotel.java new file mode 100644 index 00000000..584fe584 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/NotificationHotel.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/OrderInfo.java b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/OrderInfo.java index cc887138..0ff091ad 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/OrderInfo.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/OrderInfo.java @@ -47,6 +47,14 @@ public class OrderInfo { private String supplierOrderCreateTime; private boolean ruleViolate; private RuleViolateDetail ruleViolateDetail; + private HotelInfo hotelInfo; + private DayPrice dayPrice; + private List residents; + private List residentList; + private ContactPerson contactPerson; + private RefundInfo refundInfo; + private TravelData travelData; + private List roomList; private String foulReason; private String foulReasonCode; private String foulReasonNote; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/Param.java b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/Param.java new file mode 100644 index 00000000..aaa70e27 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/Param.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokeController.java b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokeController.java new file mode 100644 index 00000000..fbbae55c --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokeController.java @@ -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; + } + +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushDTO.java b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushDTO.java new file mode 100644 index 00000000..47b0a14d --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushDTO.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushResult.java b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushResult.java new file mode 100644 index 00000000..43029adb --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/strokepush/StrokePushResult.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/ticketpush/NotifyData.java b/src/main/java/com/chint/interfaces/rest/ly/dto/ticketpush/NotifyData.java index 73ff57a7..1129403b 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/ticketpush/NotifyData.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/ticketpush/NotifyData.java @@ -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; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Notification.java b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Notification.java deleted file mode 100644 index 594c45ca..00000000 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Notification.java +++ /dev/null @@ -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; // 推送唯一秘钥 -} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotificationTrain.java b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotificationTrain.java new file mode 100644 index 00000000..d7c141e9 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotificationTrain.java @@ -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; +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotifyData.java b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotifyData.java index 1a13dea7..85dfd131 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotifyData.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/NotifyData.java @@ -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 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; } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Passenger.java b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Passenger.java new file mode 100644 index 00000000..9a5a2dea --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/Passenger.java @@ -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... +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/RuleViolateDetail.java b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/RuleViolateDetail.java new file mode 100644 index 00000000..433ff3bb --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/trainorderdatapushback/RuleViolateDetail.java @@ -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 items; + + // Getters and Setters... +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/CarBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/CarBackController.java index 5a5adbcb..8c2f2c9a 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/CarBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/CarBackController.java @@ -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) { diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java new file mode 100644 index 00000000..3d19e563 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java @@ -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", "失败"); + }; + + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/FlyBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/FlyBackController.java index 621c465d..588961b9 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/FlyBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/FlyBackController.java @@ -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) { diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java index 2ea537bc..1ab1a25b 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java @@ -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", "未收到消息"); } diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/TrainBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/TrainBackController.java index d119a097..17f33b94 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/TrainBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/TrainBackController.java @@ -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) {