...
|
...
|
@@ -4,51 +4,105 @@ import com.google.common.collect.Lists; |
|
|
import com.yohoufo.order.constants.OrderDetailDesc;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public enum OrderStatus {
|
|
|
|
|
|
WAITING_PAY(0,
|
|
|
"未付款",
|
|
|
|
|
|
|
|
|
|
|
|
WAITING_PAY(0, "未付款", new Node[]{
|
|
|
new Node(
|
|
|
"待付款",
|
|
|
Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
|
|
|
Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
|
|
|
OrderDetailDesc.NO_PAY),
|
|
|
OrderDetailDesc.NO_PAY
|
|
|
),
|
|
|
new Node(
|
|
|
"待买家付款",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL),
|
|
|
null,
|
|
|
OrderDetailDesc.Seller.BUYER_NO_PAY
|
|
|
)
|
|
|
}),
|
|
|
|
|
|
HAS_PAYED(1,
|
|
|
"已付款",
|
|
|
HAS_PAYED(1, "已付款", new Node[]{
|
|
|
new Node(
|
|
|
"商品调拨中",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL),
|
|
|
Lists.newArrayList(),
|
|
|
OrderDetailDesc.BUY_HAS_PAID),
|
|
|
|
|
|
SELLER_SEND_OUT(2,
|
|
|
"商品调拨中(卖家发货,可查物流)",
|
|
|
OrderDetailDesc.BUY_HAS_PAID
|
|
|
),
|
|
|
new Node(
|
|
|
"待发货",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
|
|
|
Arrays.asList(ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
|
|
|
OrderDetailDesc.Seller.BUYER_HAS_PAID
|
|
|
)
|
|
|
}),
|
|
|
|
|
|
SELLER_SEND_OUT(2, "商品调拨中(卖家发货,可查物流)", new Node[]{
|
|
|
new Node(
|
|
|
"商品调拨中",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL),
|
|
|
Lists.newArrayList(),
|
|
|
OrderDetailDesc.SELL_HAS_SENDED),
|
|
|
|
|
|
PLATFORM_CHECKING(3,
|
|
|
"有货平台鉴定中",
|
|
|
OrderDetailDesc.SELL_HAS_SENDED
|
|
|
),
|
|
|
new Node(
|
|
|
"已发货",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
|
|
|
Arrays.asList(ButtonShow.SHOW_EXPRESS),
|
|
|
null
|
|
|
)
|
|
|
}),
|
|
|
|
|
|
PLATFORM_CHECKING(3, "有货平台鉴定中", new Node[]{
|
|
|
new Node(
|
|
|
"有货平台鉴定中",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL),
|
|
|
Lists.newArrayList(),
|
|
|
OrderDetailDesc.PLATFORM_SEND),
|
|
|
|
|
|
WAITING_RECEIVE(4,
|
|
|
"待收货",
|
|
|
OrderDetailDesc.PLATFORM_SEND
|
|
|
),
|
|
|
new Node(
|
|
|
"有货平台鉴定中",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
|
|
|
Arrays.asList(ButtonShow.SHOW_EXPRESS),
|
|
|
OrderDetailDesc.Seller.IN_CHECK
|
|
|
)
|
|
|
}),
|
|
|
|
|
|
WAITING_RECEIVE(4, "待收货", new Node[]{
|
|
|
new Node(
|
|
|
"待收货",
|
|
|
Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
|
|
|
Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
|
|
|
OrderDetailDesc.CHECK_OK_SEND),
|
|
|
OrderDetailDesc.CHECK_OK_SEND
|
|
|
),
|
|
|
|
|
|
DONE(5,
|
|
|
"已完成",
|
|
|
new Node(
|
|
|
"交易成功",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList( ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.Seller.TRADE_DONE
|
|
|
)
|
|
|
}),
|
|
|
|
|
|
DONE(5, "已完成", new Node[]{
|
|
|
new Node(
|
|
|
"交易成功",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.DONE),
|
|
|
OrderDetailDesc.DONE
|
|
|
),
|
|
|
new Node(
|
|
|
"交易成功",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList( ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.Seller.TRADE_DONE
|
|
|
)
|
|
|
} ),
|
|
|
|
|
|
// TODO 这种状态不存在
|
|
|
// SELLER_CANCEL_BEFORE_PAY(10,
|
...
|
...
|
@@ -58,40 +112,57 @@ public enum OrderStatus { |
|
|
// Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
// ),
|
|
|
|
|
|
SELLER_CANCEL_AFTER_PAY(11,
|
|
|
"买家付款后卖家取消",
|
|
|
SELLER_CANCEL_AFTER_PAY(11, "买家付款后卖家取消", new Node[]{
|
|
|
new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.SELL_CANCEL_SEND),
|
|
|
OrderDetailDesc.SELL_CANCEL_SEND
|
|
|
),
|
|
|
buildFail4Seller(OrderDetailDesc.Seller.NO_SALE)
|
|
|
}
|
|
|
),
|
|
|
|
|
|
SEND_OUT_TIMEOUT(12,
|
|
|
"超时未发货取消",
|
|
|
SEND_OUT_TIMEOUT(12, "超时未发货取消", new Node[]{
|
|
|
new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.SELL_TIMETOUT_CANCEL),
|
|
|
OrderDetailDesc.SELL_TIMETOUT_CANCEL
|
|
|
),
|
|
|
buildFail4Seller(OrderDetailDesc.Seller.DELIVER_GOODS_TIMEOUT)
|
|
|
}
|
|
|
),
|
|
|
|
|
|
CHECKING_FAKE(13,
|
|
|
"鉴定不通过取消",
|
|
|
CHECKING_FAKE(13, "鉴定不通过取消", new Node[]{
|
|
|
new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.CHECK_FAKE),
|
|
|
OrderDetailDesc.CHECK_FAKE
|
|
|
),
|
|
|
buildFail4Seller(OrderDetailDesc.Seller.CHECK_FAIL)
|
|
|
}),
|
|
|
|
|
|
BUYER_CANCEL_BEFORE_PAY(14,
|
|
|
"支付前取消",
|
|
|
BUYER_CANCEL_BEFORE_PAY(14, "支付前取消", new Node[]{
|
|
|
new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.BUY_CANCEL),
|
|
|
|
|
|
BUYER_CANCEL_TIMEOUT(15,
|
|
|
"超时未支付取消",
|
|
|
"交易失败",
|
|
|
OrderDetailDesc.BUY_CANCEL
|
|
|
),
|
|
|
buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL)
|
|
|
}),
|
|
|
|
|
|
BUYER_CANCEL_TIMEOUT(15, "超时未支付取消", new Node[]{
|
|
|
new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
|
|
|
OrderDetailDesc.BUY_TIMEOUT_CANCEL),
|
|
|
OrderDetailDesc.BUY_TIMEOUT_CANCEL
|
|
|
),
|
|
|
buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL_OF_TIMEOUT)
|
|
|
}),
|
|
|
|
|
|
// CUSTOMER_SERVICE(17,
|
|
|
// "客服取消",
|
...
|
...
|
@@ -104,72 +175,105 @@ public enum OrderStatus { |
|
|
|
|
|
String desc;
|
|
|
|
|
|
/**
|
|
|
* 列表or详情显示状态
|
|
|
*/
|
|
|
String statusStr;
|
|
|
|
|
|
/**
|
|
|
* 订单列表中的按钮
|
|
|
*/
|
|
|
List<ButtonShow> listButtons;
|
|
|
|
|
|
/**
|
|
|
* 详情的按钮
|
|
|
*/
|
|
|
List<ButtonShow> detailButtons;
|
|
|
|
|
|
Node[] nodes;
|
|
|
|
|
|
/**
|
|
|
* 详情页状态说明
|
|
|
*/
|
|
|
String detailDesc;
|
|
|
|
|
|
static Node buildFail4Seller(String detailDesc){
|
|
|
return new Node(
|
|
|
"交易失败",
|
|
|
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
|
|
|
Arrays.asList(ButtonShow.DEL_ORDER),
|
|
|
detailDesc
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param code db中code
|
|
|
* @param desc db中code的含义
|
|
|
* @param statusStr 订单列表中状态显示
|
|
|
* @param listButtons 订单列表显示的按钮
|
|
|
* @param nodes db中code的含义
|
|
|
*/
|
|
|
OrderStatus(int code, String desc, String statusStr, List<ButtonShow> listButtons,
|
|
|
List<ButtonShow> detailButtons, String detailDesc) {
|
|
|
OrderStatus(int code, String desc, Node[] nodes) {
|
|
|
this.code = code;
|
|
|
this.desc = desc;
|
|
|
this.statusStr = statusStr;
|
|
|
this.listButtons = listButtons;
|
|
|
this.detailButtons = detailButtons;
|
|
|
this.detailDesc = detailDesc;
|
|
|
this.nodes = nodes;
|
|
|
}
|
|
|
|
|
|
public int getCode() {
|
|
|
return code;
|
|
|
}
|
|
|
|
|
|
private int getIndex(TabType actorType){
|
|
|
switch (actorType){
|
|
|
case BUY:
|
|
|
return 0;
|
|
|
case SELL:
|
|
|
return 1;
|
|
|
}
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
public List<ButtonShow> getListButtons() {
|
|
|
return listButtons;
|
|
|
public List<ButtonShow> getListButtons(TabType actorType) {
|
|
|
return nodes[getIndex(actorType)].listButtons;
|
|
|
}
|
|
|
|
|
|
public List<ButtonShow> getDetailButtons() {
|
|
|
return detailButtons;
|
|
|
public List<ButtonShow> getDetailButtons(TabType actorType) {
|
|
|
return nodes[getIndex(actorType)].detailButtons;
|
|
|
}
|
|
|
|
|
|
public String getDetailDesc() {
|
|
|
return detailDesc;
|
|
|
public String getDetailDesc(TabType actorType) {
|
|
|
return nodes[getIndex(actorType)].detailDesc;
|
|
|
}
|
|
|
|
|
|
public String getStatusStr() {
|
|
|
return statusStr;
|
|
|
public String getStatusStr(TabType actorType) {
|
|
|
return nodes[getIndex(actorType)].statusStr;
|
|
|
}
|
|
|
|
|
|
public static OrderStatus getOrderStatus(int code){
|
|
|
static Map<Integer,OrderStatus> localcache;
|
|
|
|
|
|
static {
|
|
|
localcache = new HashMap<>();
|
|
|
for(OrderStatus v : values()){
|
|
|
if(v.code == code){
|
|
|
return v;
|
|
|
}
|
|
|
localcache.put(v.code, v);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static OrderStatus getOrderStatus(int code){
|
|
|
|
|
|
return localcache.get(code);
|
|
|
}
|
|
|
|
|
|
public static class Node{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 列表or详情显示状态
|
|
|
*/
|
|
|
String statusStr;
|
|
|
|
|
|
/**
|
|
|
* 订单列表中的按钮
|
|
|
*/
|
|
|
List<ButtonShow> listButtons;
|
|
|
|
|
|
/**
|
|
|
* 详情的按钮
|
|
|
*/
|
|
|
List<ButtonShow> detailButtons;
|
|
|
|
|
|
/**
|
|
|
* 详情页状态说明
|
|
|
*/
|
|
|
String detailDesc;
|
|
|
|
|
|
public Node(String statusStr,
|
|
|
List<ButtonShow> listButtons,
|
|
|
List<ButtonShow> detailButtons,
|
|
|
String detailDesc) {
|
|
|
this.statusStr = statusStr;
|
|
|
this.listButtons = listButtons;
|
|
|
this.detailButtons = detailButtons;
|
|
|
this.detailDesc = detailDesc;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
} |
...
|
...
|
|