Преглед изворни кода

Merge branch 'master' of http://git.qmth.com.cn/songyue/ExamCloud-service-core.git

wangwei пре 7 година
родитељ
комит
ef00c148fc

+ 6 - 0
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/OrgApi.java

@@ -265,4 +265,10 @@ public class OrgApi {
     public ResponseEntity getAllParentOrg(){
     	return new ResponseEntity(orgRepo.findAllParentOrg(), HttpStatus.OK);
     }
+
+    @ApiOperation(value = "查询所有印刷机构", notes = "查询所有印刷机构")
+    @GetMapping("/allPrint")
+    public ResponseEntity getAllPrintOrg() {
+        return new ResponseEntity(orgRepo.findAllPrintByParentId(0L), HttpStatus.OK);
+    }
 }

+ 11 - 18
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/UserApi.java

@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.service.core.api;
 
 import io.swagger.annotations.ApiOperation;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -12,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.lang.StringEscapeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -188,15 +190,12 @@ public class UserApi {
                                       @RequestParam("newPassword") String newPassword,
                                       HttpServletRequest request) {
         AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-//        String oldPassword = params.get("oldPassword");
-//        String newPassword = params.get("newPassword");
         if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)) {
             return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
         } else {
             Long userId = accessUser.getUserId();
             User user = userRepo.findOne(userId);
             if (!oldPassword.equals(user.getPassword())) {
-
                 return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
             }
             userRepo.updatePasswordById(userId, newPassword);
@@ -263,19 +262,6 @@ public class UserApi {
         return new ResponseEntity(userService.saveMarker(accessUser.getRootOrgId(),loginName,name), HttpStatus.OK);
     }
 
-    @ApiOperation(value = "校验token", notes = "校验token")
-    @GetMapping("/checkToken")
-    public ResponseEntity checkToken(HttpServletRequest request) {
-        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-        if (accessUser == null) {
-            return new ResponseEntity(HttpStatus.NOT_FOUND);
-        } else if (StringUtils.isEmpty(accessUser.getToken())) {
-            return new ResponseEntity(HttpStatus.NOT_FOUND);
-        } else {
-            return new ResponseEntity(HttpStatus.OK);
-        }
-    }
-    
     @ApiOperation(value="查询评卷员带分页",notes="查询评卷员带分页")
     @GetMapping("/all/marker/{curPage}/{pageSize}")
     public ResponseEntity getAllMark(@ModelAttribute User user,
@@ -286,7 +272,14 @@ public class UserApi {
     	if(accessUser != null){
     		user.setRootOrgId(accessUser.getRootOrgId());
     		return new ResponseEntity(userService.getAllMaker(user,new PageRequest(curPage-1, pageSize)),HttpStatus.OK);
-    	}
-        return new ResponseEntity(HttpStatus.NOT_FOUND);
+    	}else{
+    	    return new ResponseEntity(new PageImpl<User>(new ArrayList<User>()),HttpStatus.OK);
+        }
+    }
+
+    @ApiOperation(value="查询印刷项目经理",notes="查询印刷项目经理")
+    @GetMapping("/allPrintPm")
+    public ResponseEntity getAllPrintPm(){
+        return new ResponseEntity(userRepo.findPrintPm(),HttpStatus.OK);
     }
 }

+ 1 - 1
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/enums/OrgType.java

@@ -3,7 +3,7 @@ package cn.com.qmth.examcloud.service.core.enums;
 public enum OrgType {
 	SCHOOL("学校"),
 	PRINT_QMTH("启明"),
-	PRINT_SHOP("印刷");
+	PRINT_SUPPLIER("印刷");
 	
 	private String name;
 	

+ 4 - 4
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/repo/OrgRepo.java

@@ -25,10 +25,10 @@ public interface OrgRepo extends JpaRepository<Org,Long>,QueryByExampleExecutor<
     @Query(nativeQuery = true,value = "select *from ecs_core_org where parent_id=:parentId and enable = 1")
     List<Org> findByParentId(@Param("parentId") long parentId);
 
-    @Query(nativeQuery = true,value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type = \"SCHOOL\"")
-    List<Org> findAllSchoolByParentId(@Param("parentId") long parentId);
-    
-    @Query(nativeQuery = true,value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type in (\"PRINT_QMTH\",\"PRINT_SHOP\")")
+    @Query(nativeQuery = true,value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type = \"SCHOOL\"")
+    List<Org> findAllSchoolByParentId(@Param("parentId") long parentId);
+    
+    @Query(nativeQuery = true,value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type in (\"PRINT_QMTH\",\"PRINT_SUPPLIER\")")
     List<Org> findAllPrintByParentId(@Param("parentId") long parentId);
 
     @Query(nativeQuery = true,value = "select *from ecs_core_org where parent_id=:parentId and code=:code and enable = 1")

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

@@ -44,4 +44,7 @@ public interface UserRepo extends JpaRepository<User,Long>,QueryByExampleExecuto
     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);
+
+    @Query(nativeQuery = true,value = "SELECT DISTINCT * FROM ecs_core_user us, ecs_core_user_role ur WHERE us.type = 'PRINT' and us.id = ur.user_id and ur.role_code = 'PROJECT_MANAGER' And us.enable = 1")
+    List<User> findPrintPm();
 }