|
|
@@ -1,5 +1,6 @@
|
|
|
package com.nb.web.api.utils;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
|
@@ -20,6 +21,14 @@ public class Items {
|
|
|
|
|
|
private JSONObject items;
|
|
|
|
|
|
+ public String getStringReturnDefault(PumpParams param,String defaultResult){
|
|
|
+ JSONObject result = items.getJSONObject(param.getParam());
|
|
|
+ if(ObjectUtil.isNull(result)){
|
|
|
+ return defaultResult;
|
|
|
+ }
|
|
|
+ return result.getString(VALUE);
|
|
|
+ }
|
|
|
+
|
|
|
public String getString(PumpParams param){
|
|
|
return items.getJSONObject(param.getParam()).getString(VALUE);
|
|
|
}
|