Browse Source

删除缓存处理,修改首页入驻机构和工具12条

guo00guo 5 years ago
parent
commit
23edb3eccf

+ 18 - 2
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -347,11 +347,19 @@ public class WebMediatorImpl implements ViewMediator {
 
         // 获取入驻品牌机构
         List<ResidentAgency> allResidentAgency = commonRepo.getAllResidentAgency();
-        List<EvaluationAgencyVO> agencyVOS = allResidentAgency.stream().map(residentAgency -> {
+        List<EvaluationAgencyVO> agencyVOS = new ArrayList<>();
+        List<EvaluationAgencyVO> agencyVOList = allResidentAgency.stream().map(residentAgency -> {
             EvaluationAgency agency = evaluationAgencyRepo.findAgencyById(residentAgency.getAgencyId());
             EvaluationAgencyVO evalutionAgencyVO = new EvaluationAgencyVO(agency);
             return evalutionAgencyVO;
         }).collect(Collectors.toList());
+        if (agencyVOList.size() > 12) {
+            for (int i = 0; i < 12; i++) {
+                agencyVOS.add(agencyVOList.get(i));
+            }
+        } else {
+            agencyVOS = agencyVOList;
+        }
 
         // 获取合作机构
 //        List<Partner> partnerList = commonRepo.getAllPartner();
@@ -454,10 +462,18 @@ public class WebMediatorImpl implements ViewMediator {
 
         // 获取资源和工具
         List<Resource> resourceList = commonRepo.getAllResource();
-        List<ResourceVO> resourceVOS = resourceList.stream().map(resource -> {
+        List<ResourceVO> resourceVOS = new ArrayList<>();
+        List<ResourceVO> resourceVOList = resourceList.stream().map(resource -> {
             ResourceVO resourceVO = new ResourceVO(resource);
             return resourceVO;
         }).collect(Collectors.toList());
+        if (resourceVOList.size() > 12) {
+            for (int i = 0; i < 12; i++) {
+                resourceVOS.add(resourceVOList.get(i));
+            }
+        } else {
+            resourceVOS = resourceVOList;
+        }
 
         indexInfoDTO.setApplicationTypeRank(applicationTypeRanks);
         indexInfoDTO.setAgencyRank(agencyRanks);

+ 1 - 2
site/src/main/java/com/mooctest/crowd/site/service/impl/CommonServiceImpl.java

@@ -21,7 +21,6 @@ import com.mooctest.crowd.site.service.CommonService;
 import com.mooctest.crowd.site.util.DataUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
@@ -90,7 +89,7 @@ public class CommonServiceImpl implements CommonService {
     }
 
     @Override
-    @Cacheable(value = "userCache",key = "#userId")
+//    @Cacheable(value = "userCache",key = "#userId")
     public IndexInfoDTO getIndexInfosCache(Long userId){
         IndexInfoDTO indexInfoDTO = viewMediator.renderIndexInfosCache();
         return indexInfoDTO;