增加构建通知
This commit is contained in:
parent
69fc7fe163
commit
36b04d50b8
@ -65,16 +65,16 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
|||||||
@Resource
|
@Resource
|
||||||
private ExternalSystemConverter externalSystemConverter;
|
private ExternalSystemConverter externalSystemConverter;
|
||||||
|
|
||||||
public Page<ApplicationDTO> page(ApplicationQuery query) {
|
/**
|
||||||
Page<ApplicationDTO> page = super.page(query);
|
* 填充应用的关联数据(分类和团队数量)
|
||||||
List<ApplicationDTO> content = page.getContent();
|
*/
|
||||||
|
private void fillApplicationRelations(List<ApplicationDTO> applications) {
|
||||||
if (content.isEmpty()) {
|
if (applications.isEmpty()) {
|
||||||
return page;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量查询应用分类
|
// 批量查询应用分类
|
||||||
List<Long> categoryIds = content.stream()
|
List<Long> categoryIds = applications.stream()
|
||||||
.map(ApplicationDTO::getApplicationCategoryId)
|
.map(ApplicationDTO::getApplicationCategoryId)
|
||||||
.filter(java.util.Objects::nonNull)
|
.filter(java.util.Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -87,7 +87,7 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 批量统计团队数量
|
// 批量统计团队数量
|
||||||
List<Long> applicationIds = content.stream()
|
List<Long> applicationIds = applications.stream()
|
||||||
.map(ApplicationDTO::getId)
|
.map(ApplicationDTO::getId)
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
java.util.Map<Long, Long> teamCountMap = new java.util.HashMap<>();
|
java.util.Map<Long, Long> teamCountMap = new java.util.HashMap<>();
|
||||||
@ -101,14 +101,26 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置关联数据
|
// 设置关联数据
|
||||||
content.forEach(application -> {
|
applications.forEach(application -> {
|
||||||
if (application.getApplicationCategoryId() != null) {
|
if (application.getApplicationCategoryId() != null) {
|
||||||
application.setApplicationCategory(categoryMap.get(application.getApplicationCategoryId()));
|
application.setApplicationCategory(categoryMap.get(application.getApplicationCategoryId()));
|
||||||
}
|
}
|
||||||
application.setTeamCount(teamCountMap.getOrDefault(application.getId(), 0L));
|
application.setTeamCount(teamCountMap.getOrDefault(application.getId(), 0L));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return new PageImpl<>(content, page.getPageable(), page.getTotalElements());
|
@Override
|
||||||
|
public Page<ApplicationDTO> page(ApplicationQuery query) {
|
||||||
|
Page<ApplicationDTO> page = super.page(query);
|
||||||
|
fillApplicationRelations(page.getContent());
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ApplicationDTO> findAll(ApplicationQuery query) {
|
||||||
|
List<ApplicationDTO> list = super.findAll(query);
|
||||||
|
fillApplicationRelations(list);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user