|
@@ -25,10 +25,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -65,7 +62,7 @@ public class AgencyServiceImpl implements AgencyService {
|
|
|
private UserTaskCountDao userTaskCountDao;
|
|
|
|
|
|
@Override
|
|
|
- public EvaluationAgencyVO getDetailById(long agencyId) {
|
|
|
+ public EvaluationAgencyVO getDetailById(long userId) {
|
|
|
/*
|
|
|
先根据机构id查询出机构信息,再从task-to-user表里面找到这个机构的接的任务的数量。
|
|
|
*/
|
|
@@ -73,20 +70,26 @@ public class AgencyServiceImpl implements AgencyService {
|
|
|
|
|
|
List<String> agencyAbilities = new ArrayList<>();//机构能力list
|
|
|
//根据compentence[]从test——type表利查询对应的能力名称
|
|
|
-
|
|
|
- Optional<EvaluationAgencyPO> agencyPO = agencyDao.findById(agencyId);
|
|
|
- if (!agencyPO.isPresent()) {
|
|
|
+ EvaluationAgencyPO agencyPO = agencyDao.findByUserId(userId);
|
|
|
+ if (agencyPO==null) {
|
|
|
throw new HttpBadRequestException("机构不存在!");
|
|
|
}
|
|
|
- EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO.get());
|
|
|
- Optional<UserPO> userPO = userDao.findById(evaluationAgency.getUserId());
|
|
|
- String userCompetence = userPO.get().getPersonalCompetence();
|
|
|
+ EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO);
|
|
|
+ Optional<UserPO> userPO = userDao.findById(userId);
|
|
|
+ String userCompetence="";
|
|
|
+ if(userPO.get().getPersonalCompetence()!=null) {
|
|
|
+ userCompetence = userPO.get().getPersonalCompetence();
|
|
|
+ }
|
|
|
//将 userConpetence按逗号分搁
|
|
|
- String compentence[] = userCompetence.split(",");//JKCS,JRXCE,KKXCS,WDXCS
|
|
|
- for (int i = 0; i < compentence.length; i++) {
|
|
|
- //查询对应code的测试类型的名称比如接口测试,兼用型测试等。
|
|
|
- Optional<TestTypePO> testTypePO = testTypeDao.findByCode(compentence[i]);
|
|
|
- agencyAbilities.add(testTypePO.get().getName());
|
|
|
+ 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());
|