ximinghao 10 mesi fa
parent
commit
faf6fd11a0

+ 9 - 6
src/main/java/com/skyversation/xjcy/service/DMSService.java

@@ -156,19 +156,22 @@ public class DMSService {
                 setPage(request,page+"",pageSize+"");
                 JSONObject jsonObject = sendToDms(request);
                 if ("成功".equals(jsonObject.getString("message"))) {
-                    JSONObject content = jsonObject.getJSONObject("content");
-                    count = content.getInteger("count");
-                    JSONArray data = content.getJSONArray("data");
-                    for (int i = 0; i < data.size(); i++) {
-                        list.add(data.getJSONObject(i));
+                    JSONArray content = jsonObject.getJSONArray("content");
+                    if (content.isEmpty()){
+                        break;
+                    }
+                    for (int i = 0; i < content.size(); i++) {
+                        list.add(content.getJSONObject(i));
                     }
                 }else {
                     break;
                 }
             } catch (Exception e) {
                 break;
+            }finally {
+                page++;
             }
-        }while (++page*pageSize < count);
+        }while (true);
 
         return list;
     }