Explorar el Código

定向获取机构和人员时限制为接包用户

郭超 hace 4 años
padre
commit
8045802fbf

+ 2 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/EvaluationAgencyDao.java

@@ -29,6 +29,8 @@ public interface EvaluationAgencyDao extends PagingAndSortingRepository<Evaluati
 
     List<EvaluationAgencyPO> findAllByIsAuthenticationAndIsDeleted(int isAuthentication, int isDeleted);
 
+    List<EvaluationAgencyPO> findAllByIsAuthenticationAndTypeLikeAndIsDeleted(int isAuthentication, String typeLike, int isDeleted);
+
     @Override
     void delete(EvaluationAgencyPO evaluationAgencyPO);
 

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/dao/PersonalAuthenticationDao.java

@@ -25,7 +25,7 @@ public interface PersonalAuthenticationDao extends PagingAndSortingRepository<Pe
 
     List<PersonalAuthenticationPO> findAll();
 
-    List<PersonalAuthenticationPO> findAllByIsDeletedAndIsAuthentication(int deletedStatus, int isAuth);
+    List<PersonalAuthenticationPO> findAllByIsDeletedAndTypeLikeAndIsAuthentication(int deletedStatus, String typeLike, int isAuth);
 
     PersonalAuthenticationPO save(PersonalAuthenticationPO personalAuthenticationPO);
 

+ 24 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/AuthType.java

@@ -0,0 +1,24 @@
+package com.mooctest.crowd.domain.domainobject;
+
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+public enum AuthType {
+    // 0是发包 1是接包
+
+    RECEIVABLE(1, "RECEIVABLE"),
+    PUBLISHABLE(0, "PUBLISHABLE");
+
+    private int id;
+    private String type;
+
+    public int getId() {
+        return id;
+    }
+
+    public String getName() {
+        return type;
+    }
+}

+ 9 - 1
core/src/main/java/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo.java

@@ -69,9 +69,17 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
         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.findAllByIsDeletedAndIsAuthentication(DeletedStatus.isNotDeleted, AuthenticationStatus.isAuthenticated).stream().map(personalAuthPO -> Converter.convert(PersonalAuthentication.class, personalAuthPO)).collect(Collectors.toList());
+       return personalAuthDao.findAllByIsDeletedAndTypeLikeAndIsAuthentication(DeletedStatus.isNotDeleted, "%"+AuthType.RECEIVABLE.getId()+"%", AuthenticationStatus.isAuthenticated).stream().map(personalAuthPO -> Converter.convert(PersonalAuthentication.class, personalAuthPO)).collect(Collectors.toList());
     }
 
     @Override

+ 5 - 0
core/src/main/java/com/mooctest/crowd/domain/repository/IEvaluationAgencyRepo.java

@@ -3,6 +3,7 @@ package com.mooctest.crowd.domain.repository;
 import com.mooctest.crowd.domain.domainobject.EvaluationAgency;
 import com.mooctest.crowd.domain.domainobject.EvaluationAgencyAbility;
 import com.mooctest.crowd.domain.domainobject.EvaluationAgencyResource;
+import com.mooctest.crowd.domain.domainobject.PersonalAuthentication;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
@@ -20,6 +21,10 @@ public interface IEvaluationAgencyRepo {
 
     List<EvaluationAgency> findAll();
 
+    List<EvaluationAgency> findAllAuthenticatedReceivable();
+
+    List<PersonalAuthentication> findAllPersonalAuth();
+
     EvaluationAgencyResource findById(Long id);
 
     List<EvaluationAgencyResource> findByEvaluationAgencyId(Long evaluationAgencyId);

+ 2 - 2
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -1074,8 +1074,8 @@ public class WebMediatorImpl implements ViewMediator {
     @Override
     public List<TestUserOrAgencyVO> renderAgencyAndTestUserList() {
         List<TestUserOrAgencyVO> testUserOrAgencyVOS = new ArrayList<>();
-        testUserOrAgencyVOS.addAll(evaluationAgencyRepo.findAll().stream().map(TestUserOrAgencyVO::new).collect(Collectors.toList()));
-        testUserOrAgencyVOS.addAll( evaluationAgencyRepo.findAllPersonalAuth().stream().map(TestUserOrAgencyVO::new).collect(Collectors.toList()));
+        testUserOrAgencyVOS.addAll(evaluationAgencyRepo.findAllAuthenticatedReceivable().stream().map(TestUserOrAgencyVO::new).collect(Collectors.toList()));
+        testUserOrAgencyVOS.addAll(evaluationAgencyRepo.findAllPersonalAuth().stream().map(TestUserOrAgencyVO::new).collect(Collectors.toList()));
         return testUserOrAgencyVOS;
     }