| | |
| | | } else{ |
| | | response = JSONUtil.parseObj(responseJson); |
| | | } |
| | | if (response.getStr(apiConfig.getResultCodeKey()).equals("0")) { |
| | | if (response.getStr(apiConfig.getResultCodeKey()).equals("1")) { |
| | | AjaxResult ajaxResult = AjaxResult.success(); |
| | | JSONArray resultData = response.getJSONArray(apiConfig.getResultDataKey()); |
| | | List<Map<String, String>> list = new ArrayList<>(); |
| | | for (Object resultDatum : resultData) { |
| | | JSONObject object = (JSONObject) resultDatum; |
| | | ajaxResult = save(object, type,apiConfig,JSONUtil.toJsonStr(params)); |
| | | Map<String, String> map = new HashMap<>(); |
| | | for (String key : object.keySet()) { |
| | | String defaultVal = object.get(key).toString(); |
| | | String val = defaultVal.trim().replaceAll("\\s+", ""); |
| | | map.put(key, val); |
| | | if (response.getStr(apiConfig.getResultDataKey()) != null && StrUtil.isNotBlank(response.getStr(apiConfig.getResultDataKey()))){ |
| | | JSONArray resultData = response.getJSONArray(apiConfig.getResultDataKey()); |
| | | List<Map<String, String>> list = new ArrayList<>(); |
| | | for (Object resultDatum : resultData) { |
| | | JSONObject object = (JSONObject) resultDatum; |
| | | ajaxResult = save(object, type,apiConfig,JSONUtil.toJsonStr(params)); |
| | | Map<String, String> map = new HashMap<>(); |
| | | for (String key : object.keySet()) { |
| | | String defaultVal = object.get(key).toString(); |
| | | String val = defaultVal.trim().replaceAll("\\s+", ""); |
| | | map.put(key, val); |
| | | } |
| | | list.add(map); |
| | | } |
| | | list.add(map); |
| | | ajaxResult.put("data", list); |
| | | }else { |
| | | ajaxResult.put("data",response); |
| | | } |
| | | ajaxResult.put("data", list); |
| | | return ajaxResult; |
| | | } else { |
| | | return AjaxResult.error().put("result", JSONUtil.parseObj(responseJson)); |