|
|
|
package com.engine.organization.entity;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author:dxfeng
|
|
|
|
* @createTime: 2022/06/13
|
|
|
|
* @version: 1.0
|
|
|
|
*/
|
|
|
|
public class SelectOptionParam {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 下拉框Json转换
|
|
|
|
*
|
|
|
|
* @param customValue
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static List<SearchConditionOption> convertJsonToListOption(String customValue) {
|
|
|
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
|
|
|
JSONArray objects = JSONObject.parseArray(customValue);
|
|
|
|
if (objects.size() < 3) {
|
|
|
|
return selectOptions;
|
|
|
|
}
|
|
|
|
JSONObject o = (JSONObject) objects.get(2);
|
|
|
|
JSONArray datas = o.getJSONArray("datas");
|
|
|
|
if (!datas.isEmpty()) {
|
|
|
|
int size = datas.size();
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
JSONObject jsonObject = (JSONObject) datas.get(i);
|
|
|
|
SearchConditionOption option = new SearchConditionOption(jsonObject.getString("key"), jsonObject.getString("option"));
|
|
|
|
selectOptions.add(option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return selectOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取自定义浏览按钮标识
|
|
|
|
*
|
|
|
|
* @param customValue
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static String getCustomBrowserId(String customValue) {
|
|
|
|
try {
|
|
|
|
JSONArray objects = JSONObject.parseArray(customValue);
|
|
|
|
if (null != objects && objects.size() > 2) {
|
|
|
|
JSONObject object = (JSONObject) objects.get(2);
|
|
|
|
return object.getString("value");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
return customValue;
|
|
|
|
}
|
|
|
|
}
|