|
@@ -4,9 +4,9 @@ import com.mooctest.crowd.domain.dao.*;
|
|
|
import com.mooctest.crowd.domain.domainobject.*;
|
|
|
import com.mooctest.crowd.domain.exception.BaseException;
|
|
|
import com.mooctest.crowd.domain.exception.EvaluationAgencyNotExistException;
|
|
|
-import com.mooctest.crowd.domain.exception.HttpBadRequestException;
|
|
|
import com.mooctest.crowd.domain.exception.UserNotExistException;
|
|
|
-import com.mooctest.crowd.domain.model.*;
|
|
|
+import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
|
|
|
+import com.mooctest.crowd.domain.model.UserTaskCountPO;
|
|
|
import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
|
|
|
import com.mooctest.crowd.domain.repository.UserRepo;
|
|
|
import com.mooctest.crowd.site.anticorruption.UserAntiCorruption;
|
|
@@ -25,7 +25,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -62,46 +64,49 @@ public class AgencyServiceImpl implements AgencyService {
|
|
|
private UserTaskCountDao userTaskCountDao;
|
|
|
|
|
|
@Override
|
|
|
- public EvaluationAgencyVO getDetailById(long userId) {
|
|
|
+ public EvaluationAgencyVO getDetailById(long userId) {
|
|
|
+ EvaluationAgency agency = evaluationAgencyRepo.findAgencyByUserId(userId);
|
|
|
+ EvaluationAgencyVO agencyVO = new EvaluationAgencyVO(agency);
|
|
|
/*
|
|
|
- 先根据机构id查询出机构信息,再从task-to-user表里面找到这个机构的接的任务的数量。
|
|
|
+ 先根据机构的userId查询出机构信息,再从user_task_count表里面找到这个机构的接的任务的数量。
|
|
|
*/
|
|
|
+ UserTaskCount taskCountByUserId = userRepo.getUserTaskCountByUserId(userId);
|
|
|
+ agencyVO.setTaskCount(taskCountByUserId.getCount());
|
|
|
|
|
|
-
|
|
|
- List<String> agencyAbilities = new ArrayList<>();//机构能力list
|
|
|
- //根据compentence[]从test——type表利查询对应的能力名称
|
|
|
- EvaluationAgencyPO agencyPO = agencyDao.findByUserId(userId);
|
|
|
- if (agencyPO==null) {
|
|
|
- throw new HttpBadRequestException("机构不存在!");
|
|
|
- }
|
|
|
- EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO);
|
|
|
- Optional<UserPO> userPO = userDao.findById(userId);
|
|
|
- String userCompetence="";
|
|
|
- if(userPO.get().getPersonalCompetence()!=null) {
|
|
|
- userCompetence = userPO.get().getPersonalCompetence();
|
|
|
- }
|
|
|
- //将 userConpetence按逗号分搁
|
|
|
- List<String> compentenceList=new ArrayList<>();
|
|
|
- System.out.println(userCompetence+"sasssss");
|
|
|
- if (userCompetence!=null&&!userCompetence.trim().equals("")){
|
|
|
- compentenceList= Arrays.asList(userCompetence.split(",")); //JKCS,JRXCE,KKXCS,WDXCS
|
|
|
- for (int i = 0; i < compentenceList.size(); i++) {
|
|
|
- //查询对应code的测试类型的名称比如接口测试,兼用型测试等。
|
|
|
- Optional<TestTypePO> testTypePO = testTypeDao.findByCode(compentenceList.get(i));
|
|
|
- agencyAbilities.add(testTypePO.get().getName());
|
|
|
- }
|
|
|
- }
|
|
|
- EvaluationAgencyVO agencyVO = new EvaluationAgencyVO(evaluationAgency);
|
|
|
- agencyVO.setAuthStatus(evaluationAgency.getIsAuthentication());
|
|
|
- List<RankCountInfo> rankCountInfoList = taskToUserDao.findTotalCountOfUser();
|
|
|
- long ids[] = new long[rankCountInfoList.size()];
|
|
|
- for (int i = 0; i < ids.length; i++) {
|
|
|
- ids[i] = rankCountInfoList.get(i).getEntityId();
|
|
|
- if (ids[i] == agencyVO.getUserId()) {
|
|
|
- agencyVO.setTaskCount(rankCountInfoList.get(i).getCount());
|
|
|
- }
|
|
|
- }
|
|
|
- agencyVO.setAgencyAbilities(agencyAbilities);
|
|
|
+// List<String> agencyAbilities = new ArrayList<>();//机构能力list
|
|
|
+// //根据compentence[]从test——type表利查询对应的能力名称
|
|
|
+// EvaluationAgencyPO agencyPO = agencyDao.findByUserId(userId);
|
|
|
+// if (agencyPO==null) {
|
|
|
+// throw new HttpBadRequestException("机构不存在!");
|
|
|
+// }
|
|
|
+// EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO);
|
|
|
+// Optional<UserPO> userPO = userDao.findById(userId);
|
|
|
+// String userCompetence="";
|
|
|
+// if(userPO.get().getPersonalCompetence()!=null) {
|
|
|
+// userCompetence = userPO.get().getPersonalCompetence();
|
|
|
+// }
|
|
|
+// //将 userConpetence按逗号分搁
|
|
|
+// List<String> compentenceList=new ArrayList<>();
|
|
|
+// System.out.println(userCompetence+"sasssss");
|
|
|
+// if (userCompetence!=null&&!userCompetence.trim().equals("")){
|
|
|
+// compentenceList= Arrays.asList(userCompetence.split(",")); //JKCS,JRXCE,KKXCS,WDXCS
|
|
|
+// for (int i = 0; i < compentenceList.size(); i++) {
|
|
|
+// //查询对应code的测试类型的名称比如接口测试,兼用型测试等。
|
|
|
+// Optional<TestTypePO> testTypePO = testTypeDao.findByCode(compentenceList.get(i));
|
|
|
+// agencyAbilities.add(testTypePO.get().getName());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// EvaluationAgencyVO agencyVO = new EvaluationAgencyVO(evaluationAgency);
|
|
|
+// agencyVO.setAuthStatus(evaluationAgency.getIsAuthentication());
|
|
|
+// List<RankCountInfo> rankCountInfoList = taskToUserDao.findTotalCountOfUser();
|
|
|
+// long ids[] = new long[rankCountInfoList.size()];
|
|
|
+// for (int i = 0; i < ids.length; i++) {
|
|
|
+// ids[i] = rankCountInfoList.get(i).getEntityId();
|
|
|
+// if (ids[i] == agencyVO.getUserId()) {
|
|
|
+// agencyVO.setTaskCount(rankCountInfoList.get(i).getCount());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// agencyVO.setAgencyAbilities(agencyAbilities);
|
|
|
return agencyVO;
|
|
|
}
|
|
|
|