过滤未产生费用的订单明细数据回推
This commit is contained in:
parent
14a4e28eed
commit
a274e4ce48
|
@ -75,7 +75,6 @@ public class LoginController {
|
||||||
private ANFeiShuLoginStrategy anFeiShuLoginStrategy;
|
private ANFeiShuLoginStrategy anFeiShuLoginStrategy;
|
||||||
|
|
||||||
@ApiOperation("财务共享登录")
|
@ApiOperation("财务共享登录")
|
||||||
@Transactional
|
|
||||||
@GetMapping("/login")
|
@GetMapping("/login")
|
||||||
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno,
|
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno,
|
||||||
@RequestParam("syscode") String syscode,
|
@RequestParam("syscode") String syscode,
|
||||||
|
@ -123,7 +122,6 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("商旅平台单点")
|
@ApiOperation("商旅平台单点")
|
||||||
@Transactional
|
|
||||||
@PostMapping("/login/sso")
|
@PostMapping("/login/sso")
|
||||||
public Result<UserLoginResult> loginSSO(@RequestBody UserLoginParam userLoginParam) {
|
public Result<UserLoginResult> loginSSO(@RequestBody UserLoginParam userLoginParam) {
|
||||||
|
|
||||||
|
@ -146,7 +144,6 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("商旅平台移动端单点")
|
@ApiOperation("商旅平台移动端单点")
|
||||||
@Transactional
|
|
||||||
@PostMapping("/login/sso/mobile")
|
@PostMapping("/login/sso/mobile")
|
||||||
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam) {
|
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam) {
|
||||||
|
|
||||||
|
@ -170,7 +167,6 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("安能商旅平台单点")
|
@ApiOperation("安能商旅平台单点")
|
||||||
@Transactional
|
|
||||||
@PostMapping("/AN/login/sso")
|
@PostMapping("/AN/login/sso")
|
||||||
public Result<UserLoginResult> ANLoginSSO(@RequestBody UserLoginParam userLoginParam) {
|
public Result<UserLoginResult> ANLoginSSO(@RequestBody UserLoginParam userLoginParam) {
|
||||||
String employeeNo = anFeiShuLoginStrategy.login(userLoginParam.getCode());
|
String employeeNo = anFeiShuLoginStrategy.login(userLoginParam.getCode());
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.chint.infrastructure.echo_framework.dispatch.Properties;
|
||||||
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
|
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ public class SupplierServiceImpl implements SupplierService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailRepository orderDetailRepository;
|
private OrderDetailRepository orderDetailRepository;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) {
|
public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) {
|
||||||
String supplierName = callbackData.getSupplierName();
|
String supplierName = callbackData.getSupplierName();
|
||||||
|
|
|
@ -22,6 +22,8 @@ public class OrderConstant {
|
||||||
public static final int ORDER_EVENT_UNKNOWN = -99;
|
public static final int ORDER_EVENT_UNKNOWN = -99;
|
||||||
public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件";
|
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";
|
public static final String ORDER_DETAIL_STATUS_SUCCESS = "1";
|
||||||
|
|
|
@ -19,15 +19,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
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;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -72,45 +70,45 @@ public class CTripNoteController {
|
||||||
// return new CTripNoteResponse("1", "未收到消息");
|
// return new CTripNoteResponse("1", "未收到消息");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@PostMapping("/status")
|
@PostMapping("/status")
|
||||||
public Result<String> statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
|
public Result<String> statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
|
||||||
String json = gson.toJson(cTripStatusNotification);
|
String json = gson.toJson(cTripStatusNotification);
|
||||||
log.info(json);
|
log.info(json);
|
||||||
|
|
||||||
//创建回推日志
|
//创建回推日志
|
||||||
// SupplierCallBackLog supplierCallBackLog = SupplierCallBackLog
|
|
||||||
// .start()
|
|
||||||
// .supplier(SUPPLIER_C_TRIP)
|
|
||||||
// .callBackJson(json);
|
|
||||||
// supplierCallBackLogRepository.save(supplierCallBackLog);
|
|
||||||
|
|
||||||
|
|
||||||
String productType = cTripStatusNotification.getProductType();
|
String productType = cTripStatusNotification.getProductType();
|
||||||
|
Integer legType = translateLegType(productType);
|
||||||
|
String orderStatus = cTripStatusNotification.getOrderStatus();
|
||||||
|
|
||||||
if (productType.equals("Train") || productType.equals("OverseaTrain")) {
|
if(legType == LEG_TYPE_AIRPLANE && !CTripUtils.checkFlightStatus(orderStatus)) {
|
||||||
return Result.Success("暂不接受携程火车数据回推");
|
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 orderId = cTripStatusNotification.getOrderId();
|
||||||
String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET);
|
String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET);
|
||||||
if (!putCTripSign.equals(cTripStatusNotification.getSign())) {
|
if (!putCTripSign.equals(cTripStatusNotification.getSign())) {
|
||||||
return Result.error("sign错误");
|
return Result.error("sign错误");
|
||||||
}
|
}
|
||||||
if (orderStatus != null && orderId != null) {
|
if (orderStatus != null && orderId != null) {
|
||||||
return handlerData(orderId, orderStatus, productType);
|
return handlerData(orderId, orderStatus, legType);
|
||||||
}
|
}
|
||||||
return Result.error("未收到消息");
|
return Result.error("未收到消息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Result<String> handlerData(String orderId, String orderStatus, String productType) {
|
public Result<String> handlerData(String orderId, String orderStatus, Integer legType ) {
|
||||||
SupplierCallbackData supplierCallbackData =
|
SupplierCallbackData supplierCallbackData =
|
||||||
SupplierCallbackData.of(SUPPLIER_C_TRIP);
|
SupplierCallbackData.of(SUPPLIER_C_TRIP);
|
||||||
SearchOrderResponse response = cTripOrderSearchRequest
|
SearchOrderResponse response = cTripOrderSearchRequest
|
||||||
.searchOrderResponseByOrderId(orderId);
|
.searchOrderResponseByOrderId(orderId);
|
||||||
List<ItineraryEntity> itineraryList = response.getItineraryList();
|
|
||||||
supplierCallbackData.data(response);
|
supplierCallbackData.data(response);
|
||||||
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
|
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
|
||||||
|
|
||||||
|
@ -118,28 +116,20 @@ public class CTripNoteController {
|
||||||
.orderDetail(orderDetail)
|
.orderDetail(orderDetail)
|
||||||
.orderNo(orderId)
|
.orderNo(orderId)
|
||||||
.outStatus(orderStatus);
|
.outStatus(orderStatus);
|
||||||
switch (productType) {
|
switch (legType) {
|
||||||
case "FlightInternational":
|
case LEG_TYPE_AIRPLANE:
|
||||||
case "FlightDomestic":
|
|
||||||
command.eventType(CTripUtils.mapFlightStatus(orderStatus))
|
command.eventType(CTripUtils.mapFlightStatus(orderStatus))
|
||||||
.extension(getETAReason(response, LEG_TYPE_AIRPLANE));
|
.extension(getETAReason(response, LEG_TYPE_AIRPLANE));
|
||||||
break;
|
break;
|
||||||
case "HotelMember":
|
case LEG_TYPE_HOTEL:
|
||||||
case "HotelContract":
|
|
||||||
command.eventType(CTripUtils.mapHotelStatus(orderStatus))
|
command.eventType(CTripUtils.mapHotelStatus(orderStatus))
|
||||||
.extension(getETAReason(response, LEG_TYPE_HOTEL));
|
.extension(getETAReason(response, LEG_TYPE_HOTEL));
|
||||||
break;
|
break;
|
||||||
case "Train":
|
case LEG_TYPE_TRAIN:
|
||||||
case "OverseaTrain":
|
|
||||||
command.eventType(CTripUtils.mapTrainStatus(orderStatus))
|
command.eventType(CTripUtils.mapTrainStatus(orderStatus))
|
||||||
.extension(getETAReason(response, LEG_TYPE_TRAIN));
|
.extension(getETAReason(response, LEG_TYPE_TRAIN));
|
||||||
break;
|
break;
|
||||||
case "CarPickUpInternational":
|
case LEG_TYPE_TAXI:
|
||||||
case "CarRentalDomestic":
|
|
||||||
case "CarImmediately":
|
|
||||||
case "CarPickUpDomesticNew":
|
|
||||||
case "CarCharterDomestic":
|
|
||||||
case "BusTicket":
|
|
||||||
command.eventType(CTripUtils.mapCarStatus(orderStatus))
|
command.eventType(CTripUtils.mapCarStatus(orderStatus))
|
||||||
.extension(getETAReason(response, LEG_TYPE_TAXI));
|
.extension(getETAReason(response, LEG_TYPE_TAXI));
|
||||||
break;
|
break;
|
||||||
|
@ -164,7 +154,7 @@ public class CTripNoteController {
|
||||||
}
|
}
|
||||||
if (etaReason == null) {
|
if (etaReason == null) {
|
||||||
String agreementRCInfo = hotelOrderInfoEntity.getAgreementRCInfo();
|
String agreementRCInfo = hotelOrderInfoEntity.getAgreementRCInfo();
|
||||||
if(agreementRCInfo != null && agreementRCInfo.startsWith("其他")){
|
if (agreementRCInfo != null && agreementRCInfo.startsWith("其他")) {
|
||||||
etaReason = hotelOrderInfoEntity.getLowPriceRC_W();
|
etaReason = hotelOrderInfoEntity.getLowPriceRC_W();
|
||||||
} else {
|
} else {
|
||||||
etaReason = agreementRCInfo;
|
etaReason = agreementRCInfo;
|
||||||
|
@ -179,4 +169,27 @@ public class CTripNoteController {
|
||||||
default -> NO_ETA_AVAILABLE;
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
public static Integer mapHotelStatus(String status) {
|
||||||
return switch (status) {
|
return switch (status) {
|
||||||
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
|
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) {
|
public static Integer mapTrainStatus(String status) {
|
||||||
return switch (status) {
|
return switch (status) {
|
||||||
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
|
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
|
||||||
|
@ -163,4 +190,19 @@ public class CTripUtils {
|
||||||
-99;
|
-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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ public class LYNoteResponse {
|
||||||
return new LYNoteResponse("100", "OK");
|
return new LYNoteResponse("100", "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LYNoteResponse success(String resMsg) {
|
||||||
|
return new LYNoteResponse("100", resMsg);
|
||||||
|
}
|
||||||
|
|
||||||
public static LYNoteResponse error(String resMsg) {
|
public static LYNoteResponse error(String resMsg) {
|
||||||
return new LYNoteResponse("100", resMsg);
|
return new LYNoteResponse("100", resMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.chint.interfaces.rest.ly.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ResultBackFlyStatus {
|
||||||
|
private String orderSerialNo;
|
||||||
|
}
|
|
@ -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.StrokePushResult;
|
||||||
import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeParam;
|
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.dto.strokepush.TrainChange.TrainChangeRequest;
|
||||||
import com.chint.interfaces.rest.ly.tools.GetObjectNature;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -115,7 +114,7 @@ public class CommonController {
|
||||||
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
||||||
ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class);
|
ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class);
|
||||||
String orderSerialNo = orderCar.getOrder().getOrderSerialNo();
|
String orderSerialNo = orderCar.getOrder().getOrderSerialNo();
|
||||||
lyCallBackDataHandler.carCallBackData(orderSerialNo);
|
return lyCallBackDataHandler.carCallBackData(orderSerialNo);
|
||||||
}
|
}
|
||||||
return new LYNoteResponse("100", "OK");
|
return new LYNoteResponse("100", "OK");
|
||||||
}
|
}
|
||||||
|
@ -131,7 +130,7 @@ public class CommonController {
|
||||||
if (Objects.nonNull(notifyData)) {
|
if (Objects.nonNull(notifyData)) {
|
||||||
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
||||||
ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class);
|
ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class);
|
||||||
lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo());
|
return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo());
|
||||||
}
|
}
|
||||||
return new LYNoteResponse("100", "OK");
|
return new LYNoteResponse("100", "OK");
|
||||||
}
|
}
|
||||||
|
@ -149,12 +148,8 @@ public class CommonController {
|
||||||
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
||||||
ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class);
|
ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class);
|
||||||
ResultBackHotel.DataObject dataObject = resultBackHotel.getData();
|
ResultBackHotel.DataObject dataObject = resultBackHotel.getData();
|
||||||
int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0;
|
|
||||||
String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo();
|
String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo();
|
||||||
lyCallBackDataHandler.hotelCallBackData(orderSerialNo);
|
return lyCallBackDataHandler.hotelCallBackData(orderSerialNo);
|
||||||
if (ruleViolate == 0) {
|
|
||||||
sendMsg(dataObject.getTravelData().getTravelApplyNo());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new LYNoteResponse("100", "OK");
|
return new LYNoteResponse("100", "OK");
|
||||||
}
|
}
|
||||||
|
@ -171,9 +166,14 @@ public class CommonController {
|
||||||
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
|
||||||
ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class);
|
ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class);
|
||||||
ResultBackFly.DataObject dataObject = resultBackFly.getData();
|
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");
|
return new LYNoteResponse("100", "OK");
|
||||||
}
|
}
|
||||||
|
@ -239,8 +239,6 @@ public class CommonController {
|
||||||
// return new LYNoteResponse("100", "OK");
|
// return new LYNoteResponse("100", "OK");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public void sendMsg(String travelApplyNo) {
|
public void sendMsg(String travelApplyNo) {
|
||||||
StrokePushDTO strokePushDTO = new StrokePushDTO();
|
StrokePushDTO strokePushDTO = new StrokePushDTO();
|
||||||
Param param = new Param();
|
Param param = new Param();
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.LYConstant.*;
|
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_EVENT_REFUND;
|
||||||
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_STATUS_REFUSE_MSG;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class LYCallBackDataHandler {
|
public class LYCallBackDataHandler {
|
||||||
|
@ -55,6 +56,11 @@ public class LYCallBackDataHandler {
|
||||||
TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData();
|
TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData();
|
||||||
TrainDetailResponse.TravelData travelData = data.getTravelData();
|
TrainDetailResponse.TravelData travelData = data.getTravelData();
|
||||||
String outStatus = data.getOrderStatusName();
|
String outStatus = data.getOrderStatusName();
|
||||||
|
|
||||||
|
if (!LYOrderUtil.checkTrainStatus(data.getOrderStatus())) {
|
||||||
|
return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
Integer productType = L_Y_PRODUCT_TYPE_TRAIN;
|
Integer productType = L_Y_PRODUCT_TYPE_TRAIN;
|
||||||
String travelNo = travelData.getTravelApplyNo();
|
String travelNo = travelData.getTravelApplyNo();
|
||||||
Integer evenType = LYOrderUtil.mapTrainStatus(data.getOrderStatus());
|
Integer evenType = LYOrderUtil.mapTrainStatus(data.getOrderStatus());
|
||||||
|
@ -68,6 +74,11 @@ public class LYCallBackDataHandler {
|
||||||
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
||||||
String travelNo = data.getTravelData().getTravelApplyNo();
|
String travelNo = data.getTravelData().getTravelApplyNo();
|
||||||
String outStatus = orderDetails.getOrderStatusText();
|
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 evenType = LYOrderUtil.mapFlightStatus(orderDetails.getOrderStatus().toString());
|
||||||
Integer productType = L_Y_PRODUCT_TYPE_FLY;
|
Integer productType = L_Y_PRODUCT_TYPE_FLY;
|
||||||
return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
|
return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
|
||||||
|
@ -79,9 +90,18 @@ public class LYCallBackDataHandler {
|
||||||
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
||||||
String travelNo = data.getTravelData().getTravelApplyNo();
|
String travelNo = data.getTravelData().getTravelApplyNo();
|
||||||
String outStatus = orderInfo.getOrderStatusDesc();
|
String outStatus = orderInfo.getOrderStatusDesc();
|
||||||
|
|
||||||
|
|
||||||
Integer evenType = LYOrderUtil.mapHotelStatus(String.valueOf(
|
Integer evenType = LYOrderUtil.mapHotelStatus(String.valueOf(
|
||||||
orderInfo.getOrderStatus()
|
orderInfo.getOrderStatus()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (!LYOrderUtil.checkHotelStatus(String.valueOf(
|
||||||
|
orderInfo.getOrderStatus()
|
||||||
|
))) {
|
||||||
|
return LYNoteResponse.success(ORDER_STATUS_REFUSE_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
Integer productType = L_Y_PRODUCT_TYPE_HOTEL;
|
Integer productType = L_Y_PRODUCT_TYPE_HOTEL;
|
||||||
|
|
||||||
if (!evenType.equals(ORDER_EVENT_REFUND)) {
|
if (!evenType.equals(ORDER_EVENT_REFUND)) {
|
||||||
|
@ -101,8 +121,12 @@ public class LYCallBackDataHandler {
|
||||||
String travelNo = data.getTravelDataInfo().getTravelApplyNo();
|
String travelNo = data.getTravelDataInfo().getTravelApplyNo();
|
||||||
CarDetailResponse.CarOrderDetailInfo orderDetailInfo = data.getCarOrderDetailInfo();
|
CarDetailResponse.CarOrderDetailInfo orderDetailInfo = data.getCarOrderDetailInfo();
|
||||||
String outStatus = orderDetailInfo.getOrderStatusDesc();
|
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;
|
Integer productType = L_Y_PRODUCT_TYPE_CAR;
|
||||||
return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
|
return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
public static Integer mapFlightStatus(String status) {
|
||||||
return switch (status) {
|
return switch (status) {
|
||||||
case "0" -> ORDER_EVENT_ORDERED; //待审批
|
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) {
|
public static Integer mapHotelStatus(String status) {
|
||||||
return switch (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) {
|
public static Integer mapCarStatus(Integer status) {
|
||||||
return switch (status) {
|
return switch (status) {
|
||||||
|
@ -112,4 +146,16 @@ public class LYOrderUtil {
|
||||||
default -> ORDER_EVENT_UNKNOWN;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.location.basedata.PrefectureLevelCityInfoEntity;
|
||||||
import com.chint.domain.aggregates.order.Location;
|
import com.chint.domain.aggregates.order.Location;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
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.order.order_record.ctrip_order_record.CTripHotelRecord;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory;
|
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.BaseContext;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.infrastructure.util.PinyinUtil;
|
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.PostRequest;
|
||||||
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.*;
|
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.PrefectureLevelCityInfo;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.location.full.response.QueryAllPOIInfoResponseType;
|
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.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.OrderCarResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
|
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
|
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.*;
|
||||||
import java.util.stream.Collectors;
|
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;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
|
@ -128,14 +128,13 @@ public class CTripTest {
|
||||||
private OrderRecordFactorySelector orderRecordFactorySelector;
|
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${cTrip.requestSecret}")
|
@Value("${cTrip.requestSecret}")
|
||||||
private String C_TRIP_REQUEST_SECRET;
|
private String C_TRIP_REQUEST_SECRET;
|
||||||
|
|
||||||
|
|
||||||
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
|
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void syncOrder() {
|
void syncOrder() {
|
||||||
RouteOrder routeOrder = routeRepository.queryById(3892L);
|
RouteOrder routeOrder = routeRepository.queryById(3892L);
|
||||||
cTripOrderSyncAdapter.syncSupplierOrder(routeOrder);
|
cTripOrderSyncAdapter.syncSupplierOrder(routeOrder);
|
||||||
|
@ -187,13 +186,13 @@ public class CTripTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void hSingleLogin() {
|
void hSingleLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.hSingleLogin(null).getRedirectUrl());
|
System.out.println(loginRequest.hSingleLogin(null).getRedirectUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void h5LoginTest() {
|
void h5LoginTest() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.h5Login(null));
|
System.out.println(loginRequest.h5Login(null));
|
||||||
|
@ -261,10 +260,15 @@ public class CTripTest {
|
||||||
supplierService.handleSupplierCallback(supplierCallbackData);
|
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void backData() {
|
void backData() {
|
||||||
BaseContext.setCurrentUser(user);
|
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<String> submitted = cTripNoteController.statusEvent(cTripStatusNotification);
|
||||||
|
System.out.println(submitted.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
@ -592,8 +596,8 @@ public class CTripTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void generateRecord(){
|
void generateRecord() {
|
||||||
CTripHotelRecord hotelRecordByRecordId = cTripOrderDetailRepository.findHotelRecordByRecordId("99127528");
|
CTripHotelRecord hotelRecordByRecordId = cTripOrderDetailRepository.findHotelRecordByRecordId("99127528");
|
||||||
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId);
|
orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId);
|
||||||
|
|
|
@ -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.*;
|
||||||
import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto;
|
import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto;
|
||||||
import com.chint.interfaces.rest.ly.*;
|
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.applyordersync.*;
|
||||||
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
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
|
// @Test
|
||||||
void generateLyTrain() {
|
void generateLyTrain() {
|
||||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767004591541");
|
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767004591541");
|
||||||
|
|
Loading…
Reference in New Issue