|
@@ -9,6 +9,7 @@ import com.mooctest.crowd.domain.exception.EvaluationAgencyResourceNotExist;
|
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyAbilityPO;
|
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
|
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyResourcePO;
|
|
|
+import com.mooctest.crowd.domain.model.PersonalAuthenticationPO;
|
|
|
import com.mooctest.crowd.domain.util.Converter;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -57,8 +58,25 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
|
|
|
|
|
|
@Override
|
|
|
public EvaluationAgency findAgencyByUserId(Long userId){
|
|
|
- EvaluationAgencyPO evaluationAgencyPO = evaluationAgencyDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
|
- return Converter.convert(EvaluationAgency.class, evaluationAgencyPO);
|
|
|
+ Optional<EvaluationAgencyPO> evaluationAgencyPOOptional = evaluationAgencyDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
|
+ if(evaluationAgencyPOOptional.isPresent()){
|
|
|
+ return Converter.convert(EvaluationAgency.class, evaluationAgencyPOOptional.get());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String findAgencyNameByUserId(Long userId){
|
|
|
+ Optional<EvaluationAgencyPO> evaluationAgencyPOOptional = evaluationAgencyDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
|
+ if(evaluationAgencyPOOptional.isPresent()){
|
|
|
+ return evaluationAgencyPOOptional.get().getEvaluationAgencyName();
|
|
|
+ }else{
|
|
|
+ Optional<PersonalAuthenticationPO> personalAuthPOOptional = personalAuthDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
|
+ if(personalAuthPOOptional.isPresent()){
|
|
|
+ return personalAuthPOOptional.get().getRealName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|