数据回推状态映射
This commit is contained in:
parent
bf2204bcc2
commit
1adf7ae2be
|
@ -35,6 +35,7 @@ public class OrderEvent {
|
||||||
case ORDER_EVENT_ORDERED -> ORDER_EVENT_ORDERED_NAME;
|
case ORDER_EVENT_ORDERED -> ORDER_EVENT_ORDERED_NAME;
|
||||||
case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME;
|
case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME;
|
||||||
case ORDER_EVENT_UNKNOWN -> ORDER_EVENT_UNKNOWN_NAME;
|
case ORDER_EVENT_UNKNOWN -> ORDER_EVENT_UNKNOWN_NAME;
|
||||||
|
case ORDER_EVENT_FINISH -> ORDER_EVENT_FINISH_NAME;
|
||||||
default -> "未知事件";
|
default -> "未知事件";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,6 @@ public class Constant {
|
||||||
public static final int PRODUCT_TYPE_TRAIN_CAR = 2; //用车
|
public static final int PRODUCT_TYPE_TRAIN_CAR = 2; //用车
|
||||||
public static final int PRODUCT_TYPE_TRAIN_HOTEL = 3; //酒店
|
public static final int PRODUCT_TYPE_TRAIN_HOTEL = 3; //酒店
|
||||||
|
|
||||||
|
|
||||||
// 规划节点事件
|
// 规划节点事件
|
||||||
public static final int LEG_EVENT_PREPARE = 0;
|
public static final int LEG_EVENT_PREPARE = 0;
|
||||||
public static final String LEG_EVENT_PREPARE_NAME = "初始事件";
|
public static final String LEG_EVENT_PREPARE_NAME = "初始事件";
|
||||||
|
@ -142,6 +141,8 @@ public class Constant {
|
||||||
public static final int ORDER_EVENT_CHANGE = 3;
|
public static final int ORDER_EVENT_CHANGE = 3;
|
||||||
public static final String ORDER_EVENT_CHANGE_NAME = "改签";
|
public static final String ORDER_EVENT_CHANGE_NAME = "改签";
|
||||||
public static final int ORDER_EVENT_REFUND = 4;
|
public static final int ORDER_EVENT_REFUND = 4;
|
||||||
|
public static final int ORDER_EVENT_FINISH = 5;
|
||||||
|
public static final String ORDER_EVENT_FINISH_NAME = "已完成";
|
||||||
public static final String ORDER_EVENT_REFUND_NAME = "退票";
|
public static final String ORDER_EVENT_REFUND_NAME = "退票";
|
||||||
public static final int ORDER_EVENT_CANCEL = -1;
|
public static final int ORDER_EVENT_CANCEL = -1;
|
||||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||||
|
|
|
@ -17,8 +17,7 @@ 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 static com.chint.infrastructure.constant.Constant.PRODUCT_TYPE_TRAIN_CAR;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.SUPPLIER_L_Y;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用车数据回推控制层
|
* 用车数据回推控制层
|
||||||
|
@ -50,10 +49,19 @@ public class CarBackController {
|
||||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||||
.orderNo(serialNo)
|
.orderNo(serialNo)
|
||||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||||
|
|
||||||
|
command.eventType(carStatus(notification.getSubNotifyType()));
|
||||||
command.sendToQueue();
|
command.sendToQueue();
|
||||||
return new CTripNoteResponse("0", "成功收到消息");
|
return new CTripNoteResponse("0", "成功收到消息");
|
||||||
}
|
}
|
||||||
return new CTripNoteResponse("1", "未收到消息");
|
return new CTripNoteResponse("1", "未收到消息");
|
||||||
}
|
}
|
||||||
|
public Integer carStatus(Integer status) {
|
||||||
|
return switch (status) {
|
||||||
|
case 1 -> ORDER_EVENT_FINISH; // 用车订单完成
|
||||||
|
default ->
|
||||||
|
-99;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@ 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 static com.chint.infrastructure.constant.Constant.PRODUCT_TYPE_FLY;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.SUPPLIER_L_Y;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机票订单数据回推控制层
|
* 机票订单数据回推控制层
|
||||||
|
@ -50,9 +49,22 @@ public class FlyBackController {
|
||||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||||
.orderNo(serialNo)
|
.orderNo(serialNo)
|
||||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||||
|
command.eventType(mapFlightStatus(notification.getSubNotifyType()));
|
||||||
command.sendToQueue();
|
command.sendToQueue();
|
||||||
return new CTripNoteResponse("0", "成功收到消息");
|
return new CTripNoteResponse("0", "成功收到消息");
|
||||||
}
|
}
|
||||||
return new CTripNoteResponse("1", "未收到消息");
|
return new CTripNoteResponse("1", "未收到消息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer mapFlightStatus(Integer status) {
|
||||||
|
return switch (status) {
|
||||||
|
case 1,2,4,5,7,9,11,13 -> ORDER_EVENT_ORDERED; // 已下单
|
||||||
|
case 3,12 -> ORDER_EVENT_REFUND; // 退票
|
||||||
|
case 6,8 -> ORDER_EVENT_CANCEL; // 取消
|
||||||
|
default ->
|
||||||
|
// 处理未知或未映射的状态
|
||||||
|
-99;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@ 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 static com.chint.infrastructure.constant.Constant.PRODUCT_TYPE_TRAIN_HOTEL;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.SUPPLIER_L_Y;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 酒店订单数据回推控制层
|
* 酒店订单数据回推控制层
|
||||||
|
@ -55,7 +54,7 @@ public class HotelBackController {
|
||||||
.orderNo(serialNo)
|
.orderNo(serialNo)
|
||||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||||
//状态映射
|
//状态映射
|
||||||
command.eventType(mapState(notification.getSubNotifyType()));
|
command.eventType(mapHotelState(notification.getSubNotifyType()));
|
||||||
command.sendToQueue();
|
command.sendToQueue();
|
||||||
return new CTripNoteResponse("0", "成功收到消息");
|
return new CTripNoteResponse("0", "成功收到消息");
|
||||||
}
|
}
|
||||||
|
@ -63,15 +62,12 @@ public class HotelBackController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer mapState(int subNotifyType) {
|
public Integer mapHotelState(Integer subNotifyType) {
|
||||||
return switch (subNotifyType) {
|
return switch (subNotifyType) {
|
||||||
case 1 -> 1;//确认中
|
case 1 -> ORDER_EVENT_PAYED;//确认中
|
||||||
case 2 -> 2;//待入住
|
case 2,3,6 -> ORDER_EVENT_ORDERED;//待入住,已变更,已退房
|
||||||
case 3 -> 2;//已退房
|
case 4,5 -> ORDER_EVENT_CANCEL;//已取消,预定失败
|
||||||
case 4 -> 2;//已取消
|
default -> -99;
|
||||||
case 5 -> 2;//预定失败
|
|
||||||
case 6 -> 2;//已变更
|
|
||||||
default -> 0;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@ 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 static com.chint.infrastructure.constant.Constant.PRODUCT_TYPE_TRAIN;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.SUPPLIER_L_Y;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 火车票订单数据回推控制层
|
* 火车票订单数据回推控制层
|
||||||
|
@ -47,10 +46,21 @@ public class TrainBackController {
|
||||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||||
.orderNo(serialNo)
|
.orderNo(serialNo)
|
||||||
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
.outStatus(String.valueOf(notification.getSubNotifyType()));
|
||||||
|
command.eventType(mapTrainState(notification.getSubNotifyType()));
|
||||||
command.sendToQueue();
|
command.sendToQueue();
|
||||||
return new CTripNoteResponse("0", "成功收到消息");
|
return new CTripNoteResponse("0", "成功收到消息");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CTripNoteResponse("1", "未收到消息");
|
return new CTripNoteResponse("1", "未收到消息");
|
||||||
}
|
}
|
||||||
|
public Integer mapTrainState(Integer status) {
|
||||||
|
return switch (status) {
|
||||||
|
case 1,2,5,10,12 -> ORDER_EVENT_ORDERED; // 已下单
|
||||||
|
case 3 -> ORDER_EVENT_REFUND; // 退票
|
||||||
|
case 6,11,13 -> ORDER_EVENT_CANCEL; // 取消
|
||||||
|
default ->
|
||||||
|
// 处理未知或未映射的状态
|
||||||
|
-99;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue