diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java index a70a2c94..7e5dc478 100644 --- a/src/main/java/com/chint/application/out/LoginController.java +++ b/src/main/java/com/chint/application/out/LoginController.java @@ -75,7 +75,6 @@ public class LoginController { private ANFeiShuLoginStrategy anFeiShuLoginStrategy; @ApiOperation("财务共享登录") - @Transactional @GetMapping("/login") public Result login(@RequestParam("sfno") String sfno, @RequestParam("syscode") String syscode, @@ -123,7 +122,6 @@ public class LoginController { } @ApiOperation("商旅平台单点") - @Transactional @PostMapping("/login/sso") public Result loginSSO(@RequestBody UserLoginParam userLoginParam) { @@ -146,7 +144,6 @@ public class LoginController { } @ApiOperation("商旅平台移动端单点") - @Transactional @PostMapping("/login/sso/mobile") public Result loginSSOMobile(@RequestBody UserLoginParam userLoginParam) { @@ -170,7 +167,6 @@ public class LoginController { } @ApiOperation("安能商旅平台单点") - @Transactional @PostMapping("/AN/login/sso") public Result ANLoginSSO(@RequestBody UserLoginParam userLoginParam) { String employeeNo = anFeiShuLoginStrategy.login(userLoginParam.getCode()); diff --git a/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java b/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java index d760bf10..16c646e3 100644 --- a/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java +++ b/src/main/java/com/chint/domain/service/supplier/SupplierServiceImpl.java @@ -14,6 +14,7 @@ import com.chint.infrastructure.echo_framework.dispatch.Properties; import com.chint.infrastructure.echo_framework.dispatch.ResultContainer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Optional; @@ -32,6 +33,7 @@ public class SupplierServiceImpl implements SupplierService { @Autowired private OrderDetailRepository orderDetailRepository; + @Transactional @Override public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) { String supplierName = callbackData.getSupplierName(); diff --git a/src/main/java/com/chint/infrastructure/constant/OrderConstant.java b/src/main/java/com/chint/infrastructure/constant/OrderConstant.java index f5494b1c..eb4f5d3c 100644 --- a/src/main/java/com/chint/infrastructure/constant/OrderConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/OrderConstant.java @@ -22,6 +22,8 @@ public class OrderConstant { public static final int ORDER_EVENT_UNKNOWN = -99; public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件"; + public static final String ORDER_STATUS_REFUSE_MSG = "未产生费用数据不保存"; + //这批字段用于 public static final String ORDER_DETAIL_STATUS_SUCCESS = "1"; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java index 40eb04cb..0545e20c 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java @@ -19,15 +19,13 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.transaction.annotation.Transactional; 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 java.util.List; - import static com.chint.infrastructure.constant.LegConstant.*; +import static com.chint.infrastructure.constant.OrderConstant.ORDER_STATUS_REFUSE_MSG; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; @Slf4j @@ -72,45 +70,45 @@ public class CTripNoteController { // return new CTripNoteResponse("1", "未收到消息"); // } - @Transactional + @PostMapping("/status") public Result statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) { String json = gson.toJson(cTripStatusNotification); log.info(json); //创建回推日志 -// SupplierCallBackLog supplierCallBackLog = SupplierCallBackLog -// .start() -// .supplier(SUPPLIER_C_TRIP) -// .callBackJson(json); -// supplierCallBackLogRepository.save(supplierCallBackLog); - String productType = cTripStatusNotification.getProductType(); + Integer legType = translateLegType(productType); + String orderStatus = cTripStatusNotification.getOrderStatus(); - if (productType.equals("Train") || productType.equals("OverseaTrain")) { - return Result.Success("暂不接受携程火车数据回推"); + if(legType == LEG_TYPE_AIRPLANE && !CTripUtils.checkFlightStatus(orderStatus)) { + return Result.Success(ORDER_STATUS_REFUSE_MSG); + } + if(legType == LEG_TYPE_HOTEL && !CTripUtils.checkHotelStatus(orderStatus)) { + return Result.Success(ORDER_STATUS_REFUSE_MSG); + } + if(legType == LEG_TYPE_TAXI && !CTripUtils.checkCarStatus(orderStatus)) { + return Result.Success(ORDER_STATUS_REFUSE_MSG); } - String orderStatus = cTripStatusNotification.getOrderStatus(); String orderId = cTripStatusNotification.getOrderId(); String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET); if (!putCTripSign.equals(cTripStatusNotification.getSign())) { return Result.error("sign错误"); } if (orderStatus != null && orderId != null) { - return handlerData(orderId, orderStatus, productType); + return handlerData(orderId, orderStatus, legType); } return Result.error("未收到消息"); } - public Result handlerData(String orderId, String orderStatus, String productType) { + public Result handlerData(String orderId, String orderStatus, Integer legType ) { SupplierCallbackData supplierCallbackData = SupplierCallbackData.of(SUPPLIER_C_TRIP); SearchOrderResponse response = cTripOrderSearchRequest .searchOrderResponseByOrderId(orderId); - List itineraryList = response.getItineraryList(); supplierCallbackData.data(response); OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData); @@ -118,28 +116,20 @@ public class CTripNoteController { .orderDetail(orderDetail) .orderNo(orderId) .outStatus(orderStatus); - switch (productType) { - case "FlightInternational": - case "FlightDomestic": + switch (legType) { + case LEG_TYPE_AIRPLANE: command.eventType(CTripUtils.mapFlightStatus(orderStatus)) .extension(getETAReason(response, LEG_TYPE_AIRPLANE)); break; - case "HotelMember": - case "HotelContract": + case LEG_TYPE_HOTEL: command.eventType(CTripUtils.mapHotelStatus(orderStatus)) .extension(getETAReason(response, LEG_TYPE_HOTEL)); break; - case "Train": - case "OverseaTrain": + case LEG_TYPE_TRAIN: command.eventType(CTripUtils.mapTrainStatus(orderStatus)) .extension(getETAReason(response, LEG_TYPE_TRAIN)); break; - case "CarPickUpInternational": - case "CarRentalDomestic": - case "CarImmediately": - case "CarPickUpDomesticNew": - case "CarCharterDomestic": - case "BusTicket": + case LEG_TYPE_TAXI: command.eventType(CTripUtils.mapCarStatus(orderStatus)) .extension(getETAReason(response, LEG_TYPE_TAXI)); break; @@ -164,7 +154,7 @@ public class CTripNoteController { } if (etaReason == null) { String agreementRCInfo = hotelOrderInfoEntity.getAgreementRCInfo(); - if(agreementRCInfo != null && agreementRCInfo.startsWith("其他")){ + if (agreementRCInfo != null && agreementRCInfo.startsWith("其他")) { etaReason = hotelOrderInfoEntity.getLowPriceRC_W(); } else { etaReason = agreementRCInfo; @@ -179,4 +169,27 @@ public class CTripNoteController { default -> NO_ETA_AVAILABLE; }; } + + private Integer translateLegType(String productType) { + return switch (productType) { + case "FlightInternational": + case "FlightDomestic": + yield LEG_TYPE_AIRPLANE; + case "HotelMember": + case "HotelContract": + yield LEG_TYPE_HOTEL; + case "Train": + case "OverseaTrain": + yield LEG_TYPE_TRAIN; + case "CarPickUpInternational": + case "CarRentalDomestic": + case "CarImmediately": + case "CarPickUpDomesticNew": + case "CarCharterDomestic": + case "BusTicket": + yield LEG_TYPE_TAXI; + default: + yield LEG_TYPE_OTHER; + }; + } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/tools/CTripUtils.java b/src/main/java/com/chint/interfaces/rest/ctrip/tools/CTripUtils.java index bec44397..af412b6f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/tools/CTripUtils.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/tools/CTripUtils.java @@ -51,6 +51,19 @@ public class CTripUtils { }; } + public static boolean checkFlightStatus(String status) { + return !"Submitted".equals(status) && + !"Confirmed".equals(status) && + !"RebookSubmitted".equals(status) && + !"RebookToBePaid".equals(status) && + !"Approve_G".equals(status) && + !"Approving".equals(status) && + !"Approve_T".equals(status) && + !"Approve_F".equals(status) && + !"Approve_A".equals(status) && + !"Approve_C".equals(status); + } + public static Integer mapHotelStatus(String status) { return switch (status) { case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态 @@ -89,6 +102,20 @@ public class CTripUtils { }; } + public static boolean checkHotelStatus(String status) { + return !"Submitted".equals(status) && + !"Confirmed".equals(status) && + !"Wait".equals(status) && + !"CancellationFailed".equals(status) && + !"submitFailed".equals(status) && + !"Approve_G".equals(status) && + !"Approving".equals(status) && + !"Approve_T".equals(status) && + !"Approve_F".equals(status) && + !"Approve_A".equals(status) && + !"Approve_C".equals(status); + } + public static Integer mapTrainStatus(String status) { return switch (status) { case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态 @@ -163,4 +190,19 @@ public class CTripUtils { -99; }; } + + public static boolean checkCarStatus(String status) { + return !"WaitReply".equals(status) && + !"WaitService".equals(status) && + !"Redispatched".equals(status) && + !"DriverArrived".equals(status) && + !"InService".equals(status) && + !"Canceling".equals(status) && + !"Approve_G".equals(status) && + !"Approving".equals(status) && + !"Approve_T".equals(status) && + !"Approve_F".equals(status) && + !"Approve_A".equals(status) && + !"Approve_C".equals(status); + } } diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java b/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java index 093d16bd..26145aa0 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYNoteResponse.java @@ -15,6 +15,10 @@ public class LYNoteResponse { return new LYNoteResponse("100", "OK"); } + public static LYNoteResponse success(String resMsg) { + return new LYNoteResponse("100", resMsg); + } + public static LYNoteResponse error(String resMsg) { return new LYNoteResponse("100", resMsg); } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackFlyStatus.java b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackFlyStatus.java new file mode 100644 index 00000000..54ab69bd --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackFlyStatus.java @@ -0,0 +1,8 @@ +package com.chint.interfaces.rest.ly.dto; + +import lombok.Data; + +@Data +public class ResultBackFlyStatus { + private String orderSerialNo; +} 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 index c4ecab01..f2a7aa28 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java @@ -18,7 +18,6 @@ import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO; import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushResult; import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeParam; import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeRequest; -import com.chint.interfaces.rest.ly.tools.GetObjectNature; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -115,7 +114,7 @@ public class CommonController { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class); String orderSerialNo = orderCar.getOrder().getOrderSerialNo(); - lyCallBackDataHandler.carCallBackData(orderSerialNo); + return lyCallBackDataHandler.carCallBackData(orderSerialNo); } return new LYNoteResponse("100", "OK"); } @@ -131,7 +130,7 @@ public class CommonController { if (Objects.nonNull(notifyData)) { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class); - lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo()); + return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo()); } return new LYNoteResponse("100", "OK"); } @@ -149,12 +148,8 @@ public class CommonController { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class); ResultBackHotel.DataObject dataObject = resultBackHotel.getData(); - int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0; String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo(); - lyCallBackDataHandler.hotelCallBackData(orderSerialNo); - if (ruleViolate == 0) { - sendMsg(dataObject.getTravelData().getTravelApplyNo()); - } + return lyCallBackDataHandler.hotelCallBackData(orderSerialNo); } return new LYNoteResponse("100", "OK"); } @@ -171,9 +166,14 @@ public class CommonController { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class); ResultBackFly.DataObject dataObject = resultBackFly.getData(); - String orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo(); + String orderSerialNo; + if (dataObject == null) { + orderSerialNo = jsonObj.toJavaObject(ResultBackFlyStatus.class).getOrderSerialNo(); + } else { + orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo(); + } //正常流程 - lyCallBackDataHandler.flightCallBackData(orderSerialNo); + return lyCallBackDataHandler.flightCallBackData(orderSerialNo); } return new LYNoteResponse("100", "OK"); } @@ -239,8 +239,6 @@ public class CommonController { // return new LYNoteResponse("100", "OK"); // } // } - - public void sendMsg(String travelApplyNo) { StrokePushDTO strokePushDTO = new StrokePushDTO(); Param param = new Param(); diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/LYCallBackDataHandler.java b/src/main/java/com/chint/interfaces/rest/ly/in/LYCallBackDataHandler.java index 3cd97feb..fff841fe 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/LYCallBackDataHandler.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/LYCallBackDataHandler.java @@ -26,6 +26,7 @@ import java.util.List; import static com.chint.infrastructure.constant.LYConstant.*; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_REFUND; +import static com.chint.infrastructure.constant.OrderConstant.ORDER_STATUS_REFUSE_MSG; @Component public class LYCallBackDataHandler { @@ -55,6 +56,11 @@ public class LYCallBackDataHandler { TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData(); TrainDetailResponse.TravelData travelData = data.getTravelData(); String outStatus = data.getOrderStatusName(); + + if (!LYOrderUtil.checkTrainStatus(data.getOrderStatus())) { + return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG); + } + Integer productType = L_Y_PRODUCT_TYPE_TRAIN; String travelNo = travelData.getTravelApplyNo(); Integer evenType = LYOrderUtil.mapTrainStatus(data.getOrderStatus()); @@ -68,6 +74,11 @@ public class LYCallBackDataHandler { FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails(); String travelNo = data.getTravelData().getTravelApplyNo(); String outStatus = orderDetails.getOrderStatusText(); + + if (!LYOrderUtil.checkFlightStatus(orderDetails.getOrderStatus().toString())) { + return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG); + } + Integer evenType = LYOrderUtil.mapFlightStatus(orderDetails.getOrderStatus().toString()); Integer productType = L_Y_PRODUCT_TYPE_FLY; return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType); @@ -79,9 +90,18 @@ public class LYCallBackDataHandler { HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); String travelNo = data.getTravelData().getTravelApplyNo(); String outStatus = orderInfo.getOrderStatusDesc(); + + Integer evenType = LYOrderUtil.mapHotelStatus(String.valueOf( orderInfo.getOrderStatus() )); + + if (!LYOrderUtil.checkHotelStatus(String.valueOf( + orderInfo.getOrderStatus() + ))) { + return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG); + } + Integer productType = L_Y_PRODUCT_TYPE_HOTEL; if (!evenType.equals(ORDER_EVENT_REFUND)) { @@ -101,8 +121,12 @@ public class LYCallBackDataHandler { String travelNo = data.getTravelDataInfo().getTravelApplyNo(); CarDetailResponse.CarOrderDetailInfo orderDetailInfo = data.getCarOrderDetailInfo(); String outStatus = orderDetailInfo.getOrderStatusDesc(); - Integer evenType = LYOrderUtil.mapCarStatus(orderDetailInfo.getOrderStatus() - ); + + if (!LYOrderUtil.checkCarStatus(orderDetailInfo.getOrderStatus())) { + return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG); + } + + Integer evenType = LYOrderUtil.mapCarStatus(orderDetailInfo.getOrderStatus()); Integer productType = L_Y_PRODUCT_TYPE_CAR; return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType); } diff --git a/src/main/java/com/chint/interfaces/rest/ly/tools/LYOrderUtil.java b/src/main/java/com/chint/interfaces/rest/ly/tools/LYOrderUtil.java index 3748245d..5b4f3809 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/tools/LYOrderUtil.java +++ b/src/main/java/com/chint/interfaces/rest/ly/tools/LYOrderUtil.java @@ -28,6 +28,20 @@ public class LYOrderUtil { }; } + public static boolean checkTrainStatus(String status) { + return !"N".equals(status) && + !"D".equals(status) && + !"S".equals(status) && + !"G".equals(status) && + !"H".equals(status) && + !"B".equals(status) && + !"A".equals(status) && + !"O".equals(status) && + !"E".equals(status) && + !"K".equals(status) && + !"J".equals(status); + } + public static Integer mapFlightStatus(String status) { return switch (status) { case "0" -> ORDER_EVENT_ORDERED; //待审批 @@ -58,6 +72,16 @@ public class LYOrderUtil { }; } + public static boolean checkFlightStatus(String status) { + return !"0".equals(status) && + !"3".equals(status) && + !"4".equals(status) && + !"22".equals(status) && + !"60".equals(status) && + !"67".equals(status) && + !"99".equals(status); + } + public static Integer mapHotelStatus(String status) { return switch (status) { @@ -87,6 +111,16 @@ public class LYOrderUtil { }; } + public static boolean checkHotelStatus(String status) { + return !"1".equals(status) && + !"3".equals(status) && + !"4".equals(status) && + !"10".equals(status) && + !"11".equals(status) && + !"12".equals(status) && + !"13".equals(status) && + !"14".equals(status); + } public static Integer mapCarStatus(Integer status) { return switch (status) { @@ -112,4 +146,16 @@ public class LYOrderUtil { default -> ORDER_EVENT_UNKNOWN; }; } + + public static boolean checkCarStatus(Integer status) { + return 1 != status && + 2 != status && + 3 != status && + 4 != status && + 5 != status && + 6 != status && + 10 != status && + 11 != status && + 12 != status; + } } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index d71b656a..5cd9e019 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -5,7 +5,6 @@ import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity; import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord; import com.chint.domain.aggregates.user.User; import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory; @@ -17,6 +16,7 @@ import com.chint.domain.value_object.SupplierCallbackData; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.PinyinUtil; +import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.dto.PCLoginResponse; import com.chint.interfaces.rest.ctrip.*; @@ -31,7 +31,6 @@ import com.chint.interfaces.rest.ctrip.dto.location.full.response.POIData; import com.chint.interfaces.rest.ctrip.dto.location.full.response.PrefectureLevelCityInfo; import com.chint.interfaces.rest.ctrip.dto.location.full.response.QueryAllPOIInfoResponseType; import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam; -import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; @@ -50,6 +49,7 @@ import org.springframework.boot.test.context.SpringBootTest; import java.util.*; import java.util.stream.Collectors; +import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; @SpringBootTest @@ -128,14 +128,13 @@ public class CTripTest { private OrderRecordFactorySelector orderRecordFactorySelector; - @Value("${cTrip.requestSecret}") private String C_TRIP_REQUEST_SECRET; private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); -// @Test + // @Test void syncOrder() { RouteOrder routeOrder = routeRepository.queryById(3892L); cTripOrderSyncAdapter.syncSupplierOrder(routeOrder); @@ -187,13 +186,13 @@ public class CTripTest { } -// @Test + // @Test void hSingleLogin() { BaseContext.setCurrentUser(user); System.out.println(loginRequest.hSingleLogin(null).getRedirectUrl()); } -// @Test + // @Test void h5LoginTest() { BaseContext.setCurrentUser(user); System.out.println(loginRequest.h5Login(null)); @@ -261,10 +260,15 @@ public class CTripTest { supplierService.handleSupplierCallback(supplierCallbackData); } - // @Test + @Test void backData() { BaseContext.setCurrentUser(user); - cTripNoteController.handlerData("30607415392", "Paid", "HotelContract"); + Gson gson = new Gson(); + CTripStatusNotification cTripStatusNotification = gson.fromJson(""" +{"approveScenario":"","corpId":"zhengtai2024","orderId":"30141027147","orderStatus":"Dealt","productType":"HotelContract","refundType":null,"sign":"ED34B28DC55752D2672795EEEEF427A550D08E0A","statusIDs":null} + """, CTripStatusNotification.class); + Result submitted = cTripNoteController.statusEvent(cTripStatusNotification); + System.out.println(submitted.getMsg()); } // @Test @@ -592,8 +596,8 @@ public class CTripTest { } -// @Test - void generateRecord(){ + // @Test + void generateRecord() { CTripHotelRecord hotelRecordByRecordId = cTripOrderDetailRepository.findHotelRecordByRecordId("99127528"); OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId); diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 7ffb3489..9dcab656 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -30,6 +30,7 @@ import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse; import com.chint.interfaces.rest.bpm.dto.*; import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto; import com.chint.interfaces.rest.ly.*; +import com.chint.interfaces.rest.ly.dto.Notification; import com.chint.interfaces.rest.ly.dto.applyordersync.*; import com.chint.interfaces.rest.ly.dto.commonresult.Result; import com.chint.interfaces.rest.ly.dto.estimateprice.*; @@ -900,6 +901,15 @@ public class LYTest { } + @Test + void testPush() { + Gson gson = new Gson(); + Notification notification = gson.fromJson(""" + {"notifyData":"{\\"orderSerialNo\\":\\"DF24032467793615516\\",\\"ticketNo\\":\\"018-1101508006\\",\\"ticketStatus\\":5,\\"ticketRecordSegmentList\\":[{\\"flightNo\\":\\"HO1856\\",\\"status\\":5,\\"statusText\\":\\"CHECKEDIN\\",\\"carrier\\":\\"HO\\",\\"departAirportCode\\":\\"CAN\\",\\"arrivedtAirportCode\\":\\"SHA\\",\\"departTimeFull\\":\\"2024-03-25T11:25:00\\",\\"departTime\\":\\"11:25\\",\\"arriveTimeFull\\":\\"2024-03-25T13:40:00\\",\\"arriveTime\\":\\"13:40\\",\\"fareBasis\\":\\"VZD\\"}],\\"refOrderNo\\":\\"\\",\\"apiNotifyUrl\\":\\"\\"}","notifyType":1,"subNotifyType":10,"notifyTime":1711316965360,"sign":"6ae964f5953714f9a7b0593557f7321e","soleKey":"426c3ba4a6f8cea4ecc66bd63b0b7775"} + """, Notification.class); + commonController.getOrderFlight(notification); + } + // @Test void generateLyTrain() { TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767004591541");