Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-26 15:37:11 +08:00
commit 83f6fb67df
1 changed files with 20 additions and 10 deletions

View File

@ -701,13 +701,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Long userId = SecurityUser.getUser().getId();
//根据用户收藏和申请数据查出应用领域排名再根据应用领域查询热门能力推荐给用户
List<Map> applyAreaList = resourceDao.selectApplyArea(userId);
//没有收藏和申请过按最热能力选取,否则根据应用领域最多类型推荐
JSONObject object = new JSONObject();
object.put("pageNum", 0);
object.put("pageSize", 9);
object.put("orderFiled", "total");
object.put("orderType", "DESC");
Page<ResourceDTO> resultPage = (Page<ResourceDTO>) this.selectMostPopular(object);
//根据收藏和申请的资源所属应用领域最多类型推荐若没有收藏和申请数据或者查询出来的数据不足9条按最热能力选取不重复的补足
if (!applyAreaList.isEmpty()) {
ResourceDTO resourceDTO = new ResourceDTO();
ArrayList<AttrEntity> list = new ArrayList<>();
@ -724,18 +724,27 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Page<ResourceDTO> page = (Page<ResourceDTO>) this.pageWithAttrs(jsonObject, selectDTOPageSpecilTotal);
//若查出数据不足9条则在热门能力补充缺少的数量
if (page.getRecords().size() < 9) {
for (int i = 0; page.getRecords().size() < 9; i++) {
for (int j = 0; j < page.getRecords().size(); j++) {
if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) {
page.getRecords().add(resultPage.getRecords().get(i));
break;
Page<ResourceDTO> resultPage = (Page<ResourceDTO>) this.selectMostPopular(object);
do {
resultPage.getRecords().forEach(p->{
//如果集合中不存在则进行添加
if (!page.getRecords().contains(p)){
page.getRecords().add(p);
}
}
}
});
}while (page.getRecords().size() < 9);
//for (int i = 0; page.getRecords().size() < 9; i++) {
// for (int j = 0; j < page.getRecords().size(); j++) {
// if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) {
// page.getRecords().add(resultPage.getRecords().get(i));
// break;
// }
// }
//}
}
return page;
} else {
return resultPage;
return this.selectMostPopular(object);
}
}
@ -1926,6 +1935,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
result.add(componentMap);
}
return result;
}
}