宋悦 7 years ago
parent
commit
3108861fc2

+ 9 - 7
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/UserService.java

@@ -92,13 +92,15 @@ public class UserService {
             List<Predicate> predicates = new ArrayList<>();
 //            Subquery<UserRole> subquery = query.subquery(UserRole.class);
 //            Root<UserRole> subRootEntity = subquery.from(UserRole.class);
-//            Predicate predicate = cb.notEqual(subRootEntity.get("roleCode"), RoleMeta.MARKER.name());
-//            subquery.select(subRootEntity).where(predicate);
-//            predicates.add(cb.exists(subquery));
+//            List<Predicate> subPredicates = new ArrayList<Predicate>();
+//            subPredicates.add(cb.equal(subRootEntity.get("roleCode"), RoleMeta.MARKER.name()));
+//            subPredicates.add(cb.equal(subRootEntity.get("userId"), root.get("id")));
+//            subquery.select(subRootEntity).where(subPredicates.toArray(new Predicate[subPredicates.size()]));
+//            predicates.add(cb.not(cb.exists(subquery)));
+//            Join join = root.join("userRoles");
+//            predicates.add(cb.equal(join.get("roleCode"), RoleMeta.MARKER.name()));
             predicates.add(cb.equal(root.get("type"),UserType.NOT_STUDENT));
             predicates.add(cb.equal(root.get("rootOrgId"),userCriteria.getRootOrgId()));
-            Join join = root.join("userRoles");
-            predicates.add(cb.notEqual(join.get("roleCode"), "MARKER"));
             if(StringUtils.isNotEmpty(userCriteria.getLoginName())){
                 predicates.add(cb.like(root.get("loginName"),"%"+userCriteria.getLoginName()+"%"));
             }
@@ -341,7 +343,7 @@ public class UserService {
 	
 	/**
 	 * 查询评卷员带分页
-	 * @param rootOrgId
+	 * @param user
 	 * @param pageable
 	 * @return
 	 */
@@ -356,7 +358,7 @@ public class UserService {
 			predicates.add(cb.equal(root.get("type"),UserType.NOT_STUDENT));
             predicates.add(cb.equal(root.get("rootOrgId"),user.getRootOrgId()));
             Join join = root.join("userRoles");
-            predicates.add(cb.equal(join.get("roleCode"), "MARKER"));
+            predicates.add(cb.equal(join.get("roleCode"), RoleMeta.MARKER.name()));
             if(StringUtils.isNotEmpty(user.getLoginName())){
                 predicates.add(cb.like(root.get("loginName"),"%"+user.getLoginName()+"%"));
             }

+ 5 - 7
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/repo/UserRepo.java

@@ -4,7 +4,6 @@ import java.util.List;
 
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -13,7 +12,6 @@ import org.springframework.data.repository.query.Param;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
 import org.springframework.transaction.annotation.Transactional;
 
-import cn.com.qmth.examcloud.service.core.entity.Specialty;
 import cn.com.qmth.examcloud.service.core.entity.User;
 
 /**
@@ -40,10 +38,10 @@ public interface UserRepo extends JpaRepository<User,Long>,QueryByExampleExecuto
 	
 	@Query(nativeQuery = true,value = "SELECT DISTINCT * FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id = ur.user_id And us.root_org_id = ? And ur.role_code = 'MARKER' And us.enable = 1")
 	List<User> findMarkerByRootOrgId(Long rootOrgId);
-	
-	@Query(value = "SELECT distinct * FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id = ur.user_id " +
-			            "And us.root_org_id = :rootOrgId And ur.role_code = 'MARKER' And us.enable = 1 ORDER BY ?#{#pageable}",
-			    countQuery = "SELECT count(distinct us.id ) FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id  = ur.user_id " +"And us.root_org_id = :rootOrgId And ur.role_code = 'MARKER' And us.enable = 1 ORDER BY ?#{#pageable}",nativeQuery = true)
-	Page<User> findMarkerByRootOrgId(@Param("rootOrgId")long rootOrgId, Pageable pageable);
 
+    @Query(value = "SELECT distinct * FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id = ur.user_id " +
+            "And us.root_org_id = ? And ur.role_code = 'MARKER' And us.enable = 1 ORDER BY ?#{#pageable}",
+    countQuery = "SELECT count(distinct us.id) FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id = ur.user_id " +
+            "And us.root_org_id = ? And ur.role_code = 'MARKER' And us.enable = 1 ORDER BY ?#{#pageable}",nativeQuery = true)
+    Page<User> findMarkerByRootOrgId(Long rootOrgId, Pageable pageable);
 }

+ 8 - 1
core-main/src/main/resources/application-prod.properties

@@ -2,4 +2,11 @@ spring.datasource.url=jdbc:mysql://qmthmysql.mysql.rds.aliyuncs.com:3306/exam_cl
 spring.datasource.username=exam_cloud
 spring.datasource.password=examcloud123!@#
 spring.redis.host=127.0.0.1
-spring.redis.port=6379
+spring.redis.port=6379
+
+
+spring.rabbitmq.host=localhost
+spring.rabbitmq.port=5672
+spring.rabbitmq.username=examcloud
+spring.rabbitmq.password=examcloud123
+spring.rabbitmq.listener.acknowledgeMode=MANUAL