|
@@ -22,6 +22,7 @@ import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.codehaus.jettison.json.JSONException;
|
|
|
import org.codehaus.jettison.json.JSONObject;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -319,13 +320,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
Pageable pageable = PageRequest.of(0, 3);
|
|
|
int top = 3;
|
|
|
- //获取热门众测
|
|
|
- List<ApplicationTypeVO> applicationTypeRank = projectDao.findTotalCountOfApplicationType(pageable).stream().map(rankInfos -> {
|
|
|
- ApplicationType applicationType = commonRepo.getApplicationTypeByAppCode(rankInfos.getCode());
|
|
|
- ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
- applicationTypeVO.setCount(rankInfos.getCount());
|
|
|
- return applicationTypeVO;
|
|
|
- }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<ApplicationTypeVO> applicationTypeRank = getApplicationTypeRankVOS(pageable);
|
|
|
List<ApplicationTypeVO> applicationTypeRanks = new ArrayList<>();
|
|
|
if (applicationTypeRanks.size() > top) {
|
|
|
for (int i = 0; i < top; i++) {
|
|
@@ -418,6 +413,17 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return indexInfoDTO;
|
|
|
}
|
|
|
|
|
|
+ @NotNull
|
|
|
+ public List<ApplicationTypeVO> getApplicationTypeRankVOS(Pageable pageable) {
|
|
|
+ //获取热门众测
|
|
|
+ return projectDao.findTotalCountOfApplicationType(pageable).stream().map(rankInfos -> {
|
|
|
+ ApplicationType applicationType = commonRepo.getApplicationTypeByAppCode(rankInfos.getCode());
|
|
|
+ ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
+ applicationTypeVO.setCount(rankInfos.getCount());
|
|
|
+ return applicationTypeVO;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public IndexDTO renderIndex() {
|
|
|
Pageable pageable = PageRequest.of(0, 10);
|