|
|
@@ -1,6 +1,9 @@
|
|
|
package com.mrxu.framework.common.xcx.enums;
|
|
|
|
|
|
-import lombok.Data;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
public enum TradeState {
|
|
|
|
|
|
@@ -25,6 +28,19 @@ public enum TradeState {
|
|
|
this.caption = caption;
|
|
|
}
|
|
|
|
|
|
+ private static Map<String,TradeState> map = null;
|
|
|
+ public static Map<String,TradeState> getMap() {
|
|
|
+ if(map == null) {
|
|
|
+ synchronized (TradeState.class) {
|
|
|
+ map = new HashMap<String,TradeState>();
|
|
|
+ for(int i=0;i<TradeState.values().length;i++) {
|
|
|
+ map.put(TradeState.values()[i].state, TradeState.values()[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
public static TradeState getState(String state) {
|
|
|
if(SUCCESS.state.equals(state)) {
|
|
|
return SUCCESS;
|
|
|
@@ -60,4 +76,11 @@ public enum TradeState {
|
|
|
public String getCaption() {
|
|
|
return caption;
|
|
|
}
|
|
|
+
|
|
|
+ public String toString() {
|
|
|
+ JSONObject rs = new JSONObject();
|
|
|
+ rs.put("state", state);
|
|
|
+ rs.put("caption", caption);
|
|
|
+ return rs.toJSONString();
|
|
|
+ }
|
|
|
}
|