|
@@ -67,15 +67,24 @@ public class HagContentServiceImpl implements HagContentService {
|
|
|
hagContents.forEach(content -> contentVOList.add(ContentConverter.contentToContentVO(content)));
|
|
|
}
|
|
|
|
|
|
- List<ContentVO> contentVOResp = contentVOList.subList(start, start + limit);
|
|
|
|
|
|
+ int size = contentVOList.size();
|
|
|
+ if (size < start) {
|
|
|
+ return hagContentResp;
|
|
|
+ }
|
|
|
+ int toIndex = start + limit;
|
|
|
+ if (size < toIndex) {
|
|
|
+ toIndex = size;
|
|
|
+ }
|
|
|
+ List<ContentVO> contentVOResp = contentVOList.subList(start, toIndex);
|
|
|
Pagination pagination = new Pagination();
|
|
|
- pagination.setNext(start + limit + "");
|
|
|
+ pagination.setNext(toIndex + "");
|
|
|
pagination.setTotal(Long.valueOf(contentVOList.size()));
|
|
|
|
|
|
|
|
|
hagContentResp.setSource(DateUtil.getDateStr() +"-同步数据");
|
|
|
hagContentResp.setPagination(pagination);
|
|
|
+
|
|
|
hagContentResp.setContentItems(contentVOResp);
|
|
|
return hagContentResp;
|
|
|
}
|