获取城市接口的数据在idea 上正常运行 finereport上导入相关的包后能编译成功,但就是获取不到数据。package com.fr;import com.fr.data.AbstractTableData;import com.yang.api.weather.cityApi.CityApi;import com.yang.model.weather.city.City;import com.yang.model.weather.city.CityResult;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.util.Arrays;/** * @Auther: zongsenyang * @Date: 2021/5/11 - 9:41 * @description: com.demo.model.city * @version: 1.0 */public class cityTest extends AbstractTableData { public static void main(String args) { new cityTest(); } /** * 定义程序数据集的列名以及数据保存的位置 */ private String columnNames; private Object rowData; public cityTest(){ String fieldNames=getFieldNames(new City()); String columnNames=new String; for (int i=0;i<columnNames.length;i++){ columnNames=fieldNames; } City cities=getCities(); Object datas=new Object; for (int i=0;i<datas.length;i++){ for (int j=0;j<datas.length;j++){ datas=getFieldValueByName(columnNames,cities); } } this.columnNames=columnNames; this.rowData=datas; System.out.println(Arrays.toString(this.columnNames)); for(int a=0;a<10;a++){ System.out.println("------------------------"); for(int b=0;b<rowData.length;b++) { System.out.println(rowData); } } } /** *获取返回的数据 */ private City getCities(){ CityResult cr=new CityApi().getCityResult(); return cr.getResult(); } /** *获取对象属性名 */ private static String getFieldNames(Object obj){ Field fields=obj.getClass().getDeclaredFields(); String fieldNames=new String; for(int i=0;i<fields.length;i++){ //System.out.println(fields.getName()); fieldNames=fields.getName(); } return fieldNames; } /** * 根据属性名获取数据 */ private static Object getFieldValueByName(String fieldName, Object o) { try { String firstLetter = fieldName.substring(0, 1).toUpperCase(); String getter = "get" + firstLetter + fieldName.substring(1); Method method = o.getClass().getMethod(getter, new Class {}); Object value = method.invoke(o, new Object {}); return value; } catch (Exception e) { return null; } } public int getColumnCount() { return columnNames.length; } public String getColumnName(int columnIndex) { return columnNames; } public int getRowCount() { return rowData.length; } public Object getValueAt(int rowIndex, int columnIndex) { return rowData; }}上面是Linux 上的 在自己的电脑是可以获取到数据的