ShareOrdersStatusEnum.java
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.yoho.unions.common.enums;
import org.apache.commons.lang.StringUtils;
/**
* Created by mingdan.ge on 2018/5/10.
*/
public enum ShareOrdersStatusEnum {
//10-已支付 -> 20-可结算、91-不可结算取消、92-不可结算退货、93-不可结算换货、100 因拆单作废
//20-可结算 -> 30-打款中 -> 40-已打款
PAY(1,"10","已支付","待结算"),
CAN_SETTLE(2,"20","可结算","已达成"),
SETTLE(3,"30","打款中","打款中"),
HAS_SETTLE(4,"40","已打款","已打款"),
ORDER_CANCEL(2,"91","不可结算取消","未达成"),
ORDER_RETURN(2,"92","不可结算退货","未达成"),
ORDER_EXCHANGE(2,"93","不可结算换货","未达成"),
ORDER_DISCARD(2,"100","因拆单作废","未达成"),//前台不展示100类
ORDER_ZERO(2,"150","0元佣金无效","未达成"),//前台不展示150类
ACTIVITY_DISCARD(2,"200","活动作废","未达成");//前台不展示200类
private int level;//低level可以变为高level
private String code;
private String desc;
private String otherDesc;
ShareOrdersStatusEnum(int level,String code, String desc) {
this.level = level;
this.code = code;
this.desc = desc;
}
ShareOrdersStatusEnum(int level,String code, String desc, String otherDesc) {
this.level = level;
this.code = code;
this.desc = desc;
this.otherDesc = otherDesc;
}
public static int getLevelByCode(String code) {
for (ShareOrdersStatusEnum e : values()) {
if (e.getCode().equals(code)) {
return e.getLevel();
}
}
return 0;
}
public static String getDescByCode(String code){
if(StringUtils.isEmpty(code)){
return null;
}
for(ShareOrdersStatusEnum e:values()){
if (code.equals(e.getCode())) {
return e.getDesc();
}
}
return null;
}
public static String getOtherDescByCode(String code){
if(StringUtils.isEmpty(code)){
return null;
}
for(ShareOrdersStatusEnum e:values()){
if (code.equals(e.getCode())) {
return e.getOtherDesc();
}
}
return null;
}
public static boolean isFailOrder(String status) {
return (!status.equals(ShareOrdersStatusEnum.CAN_SETTLE.getCode())) && (ShareOrdersStatusEnum.getLevelByCode(status)==2);
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getOtherDesc() {
return otherDesc;
}
public void setOtherDesc(String otherDesc) {
this.otherDesc = otherDesc;
}
}