Browse Source

获取值班员数据定时任务逻辑修改

yangyue 1 month ago
parent
commit
2778178920
1 changed files with 14 additions and 0 deletions
  1. 14 0
      duty-service/src/main/java/cn/com/taiji/duty/task/TimeTask.java

+ 14 - 0
duty-service/src/main/java/cn/com/taiji/duty/task/TimeTask.java

@@ -331,6 +331,20 @@ public class TimeTask {
         JSONObject data = resData.getJSONObject("data");
         JSONArray jsonArray = data.getJSONArray("list");
         List<DutyRoleAccount> roleAccounts = JSONArray.parseArray(jsonArray.toJSONString(), DutyRoleAccount.class);
+        Integer totalSize = data.getInteger("totalSize");
+        if (totalSize > pageSize) {
+            int totalPages = (int) Math.ceil((double) totalSize / pageSize);
+            for (int i = 2; i <= totalPages; i++) {
+                url = idaasUrlPrefix + roleAccountsApi + "?privilegeUuid=" + roleZby + "&psSystemUuid="
+                        + psId + "&pageSize=" + pageSize + "&currentPage=" + i;
+                ResponseEntity<JSONObject> exchangePages = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
+                JSONObject resDataPages = exchangePages.getBody();
+                JSONObject dataPages = resDataPages.getJSONObject("data");
+                JSONArray jsonArrayPages = dataPages.getJSONArray("list");
+                List<DutyRoleAccount> roleAccountsPages = JSONArray.parseArray(jsonArrayPages.toJSONString(), DutyRoleAccount.class);
+                roleAccounts.addAll(roleAccountsPages);
+            }
+        }
         roleAccounts.forEach(dutyRoleAccount -> dutyRoleAccount.setRoleUuid(roleZby));