|
@@ -6,6 +6,7 @@ import com.mooctest.crowd.domain.repository.CrowdTestTaskRepo;
|
|
|
import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
|
|
|
import com.mooctest.crowd.site.data.dto.IndexDTO;
|
|
|
import com.mooctest.crowd.site.data.dto.IndexInfoDTO;
|
|
|
+import com.mooctest.crowd.site.data.dto.IndexPageDTO;
|
|
|
import com.mooctest.crowd.site.data.dto.MyCrowdDTO;
|
|
|
import com.mooctest.crowd.site.data.vo.*;
|
|
|
import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
@@ -16,6 +17,8 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@Service
|
|
|
public class CommonServiceImpl implements CommonService {
|
|
|
@Autowired
|
|
@@ -50,6 +53,24 @@ public class CommonServiceImpl implements CommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public IndexPageDTO getIndexPageInfo(Pageable pageable, Map<String, String> extraCondition, String keyword, int deletedStatus) {
|
|
|
+ IndexPageDTO indexPageDTO = new IndexPageDTO();
|
|
|
+ for(String key:extraCondition.keySet()) {
|
|
|
+ String value = extraCondition.get(key);
|
|
|
+ if(value.equals("0")){
|
|
|
+ indexPageDTO.setCrowdProjectPage(projectRepo.findAllByPage(pageable, keyword, deletedStatus).map(crowdTestProject -> new CrowdProjectVO(crowdTestProject)));
|
|
|
+ }else if(value.equals("1")){
|
|
|
+ indexPageDTO.setAgencyPage(agencyRepo.findAllByPage(pageable, keyword, deletedStatus).map(agency -> new AgencyVO(agency)));
|
|
|
+ }else if(value.equals("2")){
|
|
|
+ indexPageDTO.setResourcePage(commonRepo.findAllResourceByPage(pageable, keyword).map(resource -> new ResourceVO(resource)));
|
|
|
+ }else if(value.equals("3")){
|
|
|
+ indexPageDTO.setExpertPage(commonRepo.findAllExpertByPage(pageable, keyword).map(expert -> new ExpertVO(expert)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return indexPageDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Page<CrowdProjectVO> getProjectInfo(Pageable pageable, String keyword, int deletedStatus) {
|
|
|
return projectRepo.findAllByPage(pageable, keyword, deletedStatus).map(crowdTestProject -> new CrowdProjectVO(crowdTestProject));
|
|
|
}
|
|
@@ -60,21 +81,6 @@ public class CommonServiceImpl implements CommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<AgencyVO> getAgencyInfo(Pageable pageable, String keyword, int deletedStatus) {
|
|
|
- return agencyRepo.findAllByPage(pageable, keyword, deletedStatus).map(agency -> new AgencyVO(agency));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<ResourceVO> getResourceInfo(Pageable pageable, String keyword) {
|
|
|
- return commonRepo.findAllResourceByPage(pageable, keyword).map(resource -> new ResourceVO(resource));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<ExpertVO> getExpertInfo(Pageable pageable, String keyword) {
|
|
|
- return commonRepo.findAllExpertByPage(pageable, keyword).map(expert -> new ExpertVO(expert));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public ApplicationTypeVO getTestTypeByApplicationType(String applicationCode) {
|
|
|
return null;
|
|
|
}
|