|
@@ -3,6 +3,7 @@ package com.mooctest.crowd.domain.repository;
|
|
|
import com.mooctest.crowd.domain.dao.AgencyAbilityDao;
|
|
|
import com.mooctest.crowd.domain.dao.AgencyResourceDao;
|
|
|
import com.mooctest.crowd.domain.dao.EvaluationAgencyDao;
|
|
|
+import com.mooctest.crowd.domain.dao.PersonalAuthenticationDao;
|
|
|
import com.mooctest.crowd.domain.domainobject.*;
|
|
|
import com.mooctest.crowd.domain.exception.EvaluationAgencyResourceNotExist;
|
|
|
import com.mooctest.crowd.domain.model.EvaluationAgencyAbilityPO;
|
|
@@ -41,6 +42,9 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
|
|
|
@Autowired
|
|
|
private EvaluationAgencyDao evaluationAgencyDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonalAuthenticationDao personalAuthDao;
|
|
|
+
|
|
|
@Override
|
|
|
public EvaluationAgency findAgencyById(Long id){
|
|
|
Optional<EvaluationAgencyPO> evaluationAgencyPO = evaluationAgencyDao.findById(id);
|
|
@@ -51,8 +55,6 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public EvaluationAgency findAgencyByUserId(Long userId){
|
|
|
EvaluationAgencyPO evaluationAgencyPO = evaluationAgencyDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
@@ -62,12 +64,25 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
|
|
|
@Override
|
|
|
public List<EvaluationAgency> findAll() {
|
|
|
List<EvaluationAgency> evaluationAgencyList = new ArrayList<>();
|
|
|
- Iterable<EvaluationAgencyPO> agencyPOS = evaluationAgencyDao.findAll();
|
|
|
+ Iterable<EvaluationAgencyPO> agencyPOS = evaluationAgencyDao.findAllByIsAuthenticationAndIsDeleted(AuthenticationStatus.isAuthenticated, DeletedStatus.isNotDeleted);
|
|
|
agencyPOS.forEach(agencyPO -> evaluationAgencyList.add(Converter.convert(EvaluationAgency.class, agencyPO)));
|
|
|
return evaluationAgencyList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<EvaluationAgency> findAllAuthenticatedReceivable() {
|
|
|
+ List<EvaluationAgency> evaluationAgencyList = new ArrayList<>();
|
|
|
+ Iterable<EvaluationAgencyPO> agencyPOS = evaluationAgencyDao.findAllByIsAuthenticationAndTypeLikeAndIsDeleted(AuthenticationStatus.isAuthenticated, "%"+AuthType.RECEIVABLE.getId()+"%", DeletedStatus.isNotDeleted);
|
|
|
+ agencyPOS.forEach(agencyPO -> evaluationAgencyList.add(Converter.convert(EvaluationAgency.class, agencyPO)));
|
|
|
+ return evaluationAgencyList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PersonalAuthentication> findAllPersonalAuth(){
|
|
|
+ return personalAuthDao.findAllByIsDeletedAndTypeLikeAndIsAuthentication(DeletedStatus.isNotDeleted, "%"+AuthType.RECEIVABLE.getId()+"%", AuthenticationStatus.isAuthenticated).stream().map(personalAuthPO -> Converter.convert(PersonalAuthentication.class, personalAuthPO)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public EvaluationAgencyResource findById(Long id){
|
|
|
Optional<EvaluationAgencyResourcePO> evaluationAgencyResourcePOOptional = agencyResourceDao.findById(id);
|
|
|
if(!evaluationAgencyResourcePOOptional.isPresent()){
|