package com.example.sso.dao; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.example.sso.util.APIUtils; public class ThreeTwo { public static JSONArray array(String yxbh) { JSONObject jsonObject = new JSONObject(); jsonObject.put("app_id", "66c866b2d6520ecd19066bb0"); jsonObject.put("entry_id", "66cebfaa2340ecd8b90e06a1"); jsonObject.put("limit", 10000); JSONArray jsonArray = new JSONArray(); jsonArray.add("yxname"); jsonArray.add("yxbh"); jsonArray.add("yxzd"); jsonObject.put("fields", jsonArray); JSONObject filter = new JSONObject(); JSONObject rel = new JSONObject(); rel.put("rel", "and"); JSONArray cond = new JSONArray(); JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("field", "yxbh"); jsonObject1.put("method", "eq"); JSONArray jsonArray1 = new JSONArray(); jsonArray1.add(yxbh); jsonObject1.put("value", jsonArray1); cond.add(jsonObject1); filter.put("rel", rel); filter.put("cond", cond); jsonObject.put("filter", filter); String jsonString = jsonObject.toJSONString(); String select = APIUtils.select(jsonString); JSONObject jsonObject2 = JSON.parseObject(select); JSONArray jsonArray2 = jsonObject2.getJSONArray("data"); int size = jsonArray2.size(); if (size != 0) { return jsonArray2; } else { JSONArray jsonArray3 = new JSONArray(); return jsonArray3; } } }