|
@@ -7,10 +7,7 @@ import com.mooctest.crowd.domain.domainobject.*;
|
|
|
import com.mooctest.crowd.domain.exception.*;
|
|
|
import com.mooctest.crowd.domain.factory.CrowdTestProjectFactory;
|
|
|
import com.mooctest.crowd.domain.model.*;
|
|
|
-import com.mooctest.crowd.domain.repository.CommonRepo;
|
|
|
-import com.mooctest.crowd.domain.repository.CrowdTestProjectRepo;
|
|
|
-import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
|
|
|
-import com.mooctest.crowd.domain.repository.UserRepo;
|
|
|
+import com.mooctest.crowd.domain.repository.*;
|
|
|
import com.mooctest.crowd.domain.util.Converter;
|
|
|
import com.mooctest.crowd.site.command.ApplyEnterpriseAuthCommand;
|
|
|
import com.mooctest.crowd.site.command.ApplyPersonalAuthCommand;
|
|
@@ -30,6 +27,7 @@ import org.codehaus.jettison.json.JSONException;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -61,6 +59,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private CommonRepo commonRepo;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ToolRepo toolRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private CrowdTestTaskDao taskDao;
|
|
|
|
|
|
@Autowired
|
|
@@ -129,6 +130,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private EndPointDao endPointDao;
|
|
|
|
|
|
+
|
|
|
+ @Value("${file.save.path}")
|
|
|
+ private String fileSaveRootPath;
|
|
|
+
|
|
|
+ @Value("${feature.client.oss}")
|
|
|
+ private Boolean usingOss;
|
|
|
+
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> crowdTestProjects() {
|
|
|
List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
@@ -463,7 +471,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
List<Resource> resourceList = commonRepo.getAllResource();
|
|
|
List<ResourceVO> resourceVOS = new ArrayList<>();
|
|
|
List<ResourceVO> resourceVOList = resourceList.stream().map(resource -> {
|
|
@@ -478,23 +486,46 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
resourceVOS = resourceVOList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ List<Tool> toolList = toolRepo.getAllTools();
|
|
|
+ List<ToolVO> toolVOS = new ArrayList<>();
|
|
|
+ List<ToolVO> toolVOList = toolList.stream().map(tool -> new ToolVO(tool)).collect(Collectors.toList());
|
|
|
+ if (toolVOList.size() > 12) {
|
|
|
+ for (int i = 0; i < 12; i++) {
|
|
|
+ toolVOS.add(toolVOList.get(i));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ toolVOS = toolVOList;
|
|
|
+ }
|
|
|
+
|
|
|
indexInfoDTO.setApplicationTypeRank(applicationTypeRanks);
|
|
|
indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
indexInfoDTO.setUserRank(userRanks);
|
|
|
indexInfoDTO.setResourceList(resourceVOS);
|
|
|
-
|
|
|
+ indexInfoDTO.setToolList(toolVOS);
|
|
|
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());
|
|
|
+ if(usingOss){
|
|
|
+ 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());
|
|
|
+ }else{
|
|
|
+ return projectDao.findTotalCountOfApplicationType(pageable).stream().map(rankInfos -> {
|
|
|
+ ApplicationType applicationType = commonRepo.getApplicationTypeByAppCode(rankInfos.getCode());
|
|
|
+ ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
+ applicationTypeVO.setCount(rankInfos.getCount());
|
|
|
+ applicationTypeVO.setImage(fileSaveRootPath + applicationType.getImage());
|
|
|
+ return applicationTypeVO;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|