|
@@ -2,6 +2,7 @@ package com.dragonsoft.dcuc.approve.business.external.impl;
|
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.PageUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dragoninfo.dcuc.common.entity.ApiResult;
|
|
@@ -37,10 +38,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.net.URI;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author lidr huangziquan
|
|
@@ -252,14 +250,30 @@ public class DcucBusinessImpl implements IDcucBusiness {
|
|
|
Map<String, SearchParam> filters = new HashMap<>(2);
|
|
|
filters.put("orgCode", orgCodeSearchParam);
|
|
|
filters.put("labelCode", labelSearchParam);
|
|
|
+ int size = 1000;
|
|
|
+ int currentPage = 1;
|
|
|
|
|
|
- ApiSearchReq apiSearchReq = ApiSearchReq.reqInfo(1, 1000, filters);
|
|
|
+ ApiSearchReq apiSearchReq = ApiSearchReq.reqInfo(currentPage, size, filters);
|
|
|
|
|
|
ApiResultPage<UserLabel2RespVO> page = labelPage(apiSearchReq);
|
|
|
- Long total = page.getTotal();
|
|
|
- List<UserLabel2RespVO> content = page.getContent();
|
|
|
- // todo 循环获取全部
|
|
|
- return content;
|
|
|
+ List<UserLabel2RespVO> allContent = new ArrayList<>(page.getContent());
|
|
|
+
|
|
|
+ int total = 0;
|
|
|
+ if (ObjectUtil.isNotNull(page)) {
|
|
|
+ total = Math.toIntExact(page.getTotal());
|
|
|
+ }
|
|
|
+
|
|
|
+ int totalPage = PageUtil.totalPage(total, size);
|
|
|
+ currentPage++;
|
|
|
+ // 循环获取全部
|
|
|
+ for (int i = currentPage; i <= totalPage; i++) {
|
|
|
+ ApiResultPage<UserLabel2RespVO> itemPage = labelPage(apiSearchReq);
|
|
|
+ if (ObjectUtil.isNotNull(itemPage)) {
|
|
|
+ allContent.addAll(itemPage.getContent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return allContent;
|
|
|
}
|
|
|
|
|
|
@SneakyThrows(JsonProcessingException.class)
|
|
@@ -287,7 +301,7 @@ public class DcucBusinessImpl implements IDcucBusiness {
|
|
|
}
|
|
|
|
|
|
String body = resEntity.getBody();
|
|
|
- ApiResult apiResult = JSONObject.parseObject(body, ApiResult.class);
|
|
|
+ ApiResult apiResult = objectMapper.readValue(body, ApiResult.class);
|
|
|
if (ObjectUtil.isNull(apiResult)) {
|
|
|
logger.error(requestName + "信息错误:{}", body);
|
|
|
return null;
|