Browse Source

refactor: parameterize response return types

weipengtao 3 tháng trước cách đây
mục cha
commit
3043a34338

+ 3 - 3
web/src/main/java/cn/seecoder/web/controller/apitest/ApiTestController.java

@@ -31,7 +31,7 @@ public class ApiTestController {
 
     @PostMapping("/create")
     @ApiOperation(value = "创建一个新的测试任务", httpMethod = "POST")
-    public Response createApiTestMission(@RequestBody ApiTestBodyVO apiTestBodyVO) {
+    public Response<Object> createApiTestMission(@RequestBody ApiTestBodyVO apiTestBodyVO) {
         apiTestService.createApiTest(apiTestBodyVO);
         return Response.buildSuccess();
     }
@@ -46,7 +46,7 @@ public class ApiTestController {
     @GetMapping("/delete/{testId}")
     @ApiOperation(value = "删除指定测试任务", httpMethod = "DELETE")
     @ApiImplicitParam(name = "testId", dataType = "int", paramType = "query")
-    public Response deleteApiTestInfoByTestId(@PathVariable Integer testId) {
+    public Response<Object> deleteApiTestInfoByTestId(@PathVariable Integer testId) {
         apiTestService.deleteApiTest(testId);
         return Response.buildSuccess();
     }
@@ -54,7 +54,7 @@ public class ApiTestController {
     @GetMapping("/execute/{testId}")
     @ApiOperation(value = "执行制定测试任务", httpMethod = "GET")
     @ApiImplicitParam(name = "testID", dataType = "int", paramType = "query")
-    public Response executeApiTestByTestId(@PathVariable Integer testId) throws InterruptedException {
+    public Response<Object> executeApiTestByTestId(@PathVariable Integer testId) throws InterruptedException {
         apiTestService.executeApiTest(testId);
         return Response.buildSuccess();
     }

+ 2 - 2
web/src/main/java/cn/seecoder/web/controller/buglist/BugListController.java

@@ -33,7 +33,7 @@ public class BugListController {
     @PostMapping
     @ApiOperation(value = "创建一条bug list", httpMethod = "POST")
     @ApiImplicitParam(value = "bugListCreateVO", dataType = "object", paramType = "body")
-    public Response create(@RequestBody BugListCreateVO bugListCreateVO){
+    public Response<Object> create(@RequestBody BugListCreateVO bugListCreateVO){
         bugListService.create(bugListCreateVO);
         return Response.buildSuccess();
     }
@@ -48,7 +48,7 @@ public class BugListController {
     @PutMapping
     @ApiOperation(value = "更新bug list基本信息, 不需要更新的信息不需要填", httpMethod = "PUT")
     @ApiImplicitParam(value = "bugListUpdateBasicVO", dataType = "object", paramType = "body")
-    public Response updateBasicInfo(@RequestBody BugListUpdateBasicVO bugListUpdateBasicVO){
+    public Response<Object> updateBasicInfo(@RequestBody BugListUpdateBasicVO bugListUpdateBasicVO){
         bugListService.updateBasicInfo(bugListUpdateBasicVO);
         return Response.buildSuccess();
     }

+ 23 - 16
web/src/main/java/cn/seecoder/web/controller/codereview/CodeReviewController.java

@@ -1,18 +1,25 @@
 package cn.seecoder.web.controller.codereview;
 
 import cn.seecoder.common.exceptions.ServiceException;
+import cn.seecoder.web.model.enums.FileReviewStatusEnum;
 import cn.seecoder.web.model.vo.Response;
 import cn.seecoder.web.model.vo.codereview.CodeReviewCreateVO;
 import cn.seecoder.web.model.vo.codereview.CodeReviewSortedList;
 import cn.seecoder.web.model.vo.codereview.CodeReviewVO;
+import cn.seecoder.web.model.vo.codereview.FileNodeVO;
 import cn.seecoder.web.model.vo.codereview.FileReviewCreateVO;
+import cn.seecoder.web.model.vo.codereview.FileReviewVO;
+import cn.seecoder.web.model.vo.user.UserVO;
 import cn.seecoder.web.service.codereview.BranchReviewService;
 import cn.seecoder.web.service.codereview.FileReviewService;
+import com.nju.edu.gitlab.vo.BranchVO;
+import com.nju.edu.gitlab.vo.DiffVO;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Zihe Chen
@@ -42,7 +49,7 @@ public class CodeReviewController {
     @PostMapping("/branch_review")
     @ApiOperation(value = "创建一个code_review", httpMethod = "POST")
     @ApiImplicitParam(value = "codeReviewCreateVO", dataType = "object", paramType = "body")
-    public Response createBranchReview(@RequestBody CodeReviewCreateVO codeReviewCreateVO) throws ServiceException {
+    public Response<Object> createBranchReview(@RequestBody CodeReviewCreateVO codeReviewCreateVO) throws ServiceException {
         branchReviewService.create(codeReviewCreateVO);
         return Response.buildSuccess();
     }
@@ -57,7 +64,7 @@ public class CodeReviewController {
     @PutMapping("/close/{codeReviewId}")
     @ApiOperation(value = "关闭某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response close(@PathVariable Integer codeReviewId){
+    public Response<Object> close(@PathVariable Integer codeReviewId){
         branchReviewService.close(codeReviewId);
         return Response.buildSuccess();
     }
@@ -65,7 +72,7 @@ public class CodeReviewController {
     @PutMapping("/reopen/{codeReviewId}")
     @ApiOperation(value = "重开某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response reopen(@PathVariable Integer codeReviewId){
+    public Response<Object> reopen(@PathVariable Integer codeReviewId){
         branchReviewService.reopen(codeReviewId);
         return Response.buildSuccess();
     }
@@ -73,7 +80,7 @@ public class CodeReviewController {
     @PutMapping("/merge/{codeReviewId}")
     @ApiOperation(value = "合并某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response merge(@PathVariable Integer codeReviewId) throws ServiceException {
+    public Response<Object> merge(@PathVariable Integer codeReviewId) throws ServiceException {
         branchReviewService.merge(codeReviewId);
         return Response.buildSuccess();
     }
@@ -81,7 +88,7 @@ public class CodeReviewController {
     @ApiOperation(value = "获取指定项目的所有branch信息", httpMethod = "GET")
     @GetMapping("/branches/{projectId}")
     @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
-    public Response getProjectBranches(@PathVariable Integer projectId) throws ServiceException {
+    public Response<List<BranchVO>> getProjectBranches(@PathVariable Integer projectId) throws ServiceException {
         return Response.buildSuccess(branchReviewService.getBranches(projectId));
     }
 
@@ -92,7 +99,7 @@ public class CodeReviewController {
             @ApiImplicitParam(name = "fromBash", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "toBash", dataType = "String", paramType = "query")
     })
-    public Response compare(@RequestParam("projectId")Integer projectId, @RequestParam("fromBash")String fromBash,
+    public Response<Set<DiffVO>> compare(@RequestParam("projectId")Integer projectId, @RequestParam("fromBash")String fromBash,
                             @RequestParam("toBash") String toBash) throws ServiceException {
         return Response.buildSuccess(branchReviewService.compareBranches(projectId, fromBash, toBash));
     }
@@ -100,7 +107,7 @@ public class CodeReviewController {
     @PostMapping("/file_review")
     @ApiOperation(value = "创建一个文件评审任务", httpMethod = "POST")
     @ApiImplicitParam(value = "fileReviewCreateVO", dataType = "object", paramType = "body")
-    public Response createFileReview(@RequestBody FileReviewCreateVO fileReviewCreateVO){
+    public Response<Object> createFileReview(@RequestBody FileReviewCreateVO fileReviewCreateVO){
         fileReviewService.create(fileReviewCreateVO);
         return Response.buildSuccess();
     }
@@ -111,7 +118,7 @@ public class CodeReviewController {
             @ApiImplicitParam(value = "fileReviewId", dataType = "int", paramType = "query"),
             @ApiImplicitParam(value = "fileList", dataType = "array", paramType = "query")
     })
-    public Response updateFileList(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("fileList") List<String> fileList){
+    public Response<Object> updateFileList(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("fileList") List<String> fileList){
         fileReviewService.updateFileList(fileReviewId, fileList);
         return Response.buildSuccess();
     }
@@ -119,13 +126,13 @@ public class CodeReviewController {
     @GetMapping("/file_review/{fileReviewId}")
     @ApiOperation(value = "获取一个文件评审任务详细信息", httpMethod = "GET")
     @ApiImplicitParam(value = "fileReviewId", dataType = "int", paramType = "query")
-    public Response getByFileReviewId(@PathVariable int fileReviewId){
+    public Response<FileReviewVO> getByFileReviewId(@PathVariable int fileReviewId){
         return Response.buildSuccess(fileReviewService.getById(fileReviewId));
     }
 
     @GetMapping("/repository_tree")
     @ApiOperation(value = "获取仓库文件列表", httpMethod = "GET")
-    public Response getRepositoryTree(@RequestParam("projectId") int projectId, @RequestParam("branch") String branch,
+    public Response<List<FileNodeVO>> getRepositoryTree(@RequestParam("projectId") int projectId, @RequestParam("branch") String branch,
                                       @RequestParam(value = "path", required = false) String path) throws ServiceException {
         if(path != null) return Response.buildSuccess(fileReviewService.getRepositoryTree(projectId, branch, path));
         return Response.buildSuccess(fileReviewService.getRepositoryTree(projectId, branch));
@@ -133,39 +140,39 @@ public class CodeReviewController {
 
     @GetMapping("/invite")
     @ApiOperation(value = "通过手机号码邀请评审人", httpMethod = "GET")
-    public Response inviteReviewer(@RequestParam("phoneNumber") String phoneNumber) throws ServiceException {
+    public Response<UserVO> inviteReviewer(@RequestParam("phoneNumber") String phoneNumber) throws ServiceException {
         return Response.buildSuccess(fileReviewService.inviteUser(phoneNumber));
     }
 
     @GetMapping("/file_content")
     @ApiOperation(value = "获取某个文件的内容", httpMethod = "GET")
-    public Response getFileContent(@RequestParam("projectId") int projectId, @RequestParam("branch") String branch,
+    public Response<String> getFileContent(@RequestParam("projectId") int projectId, @RequestParam("branch") String branch,
                                    @RequestParam("path") String path) throws ServiceException {
         return Response.buildSuccess(fileReviewService.getFile(projectId, branch, path));
     }
 
     @PutMapping("/inspect")
     @ApiOperation(value = "将某个任务递交评审", httpMethod = "PUT")
-    public Response submitToInspect(@RequestParam("fileReviewId") int fileReviewId) {
+    public Response<Object> submitToInspect(@RequestParam("fileReviewId") int fileReviewId) {
         fileReviewService.submitToInspection(fileReviewId);
         return Response.buildSuccess();
     }
 
     @PutMapping("/rework")
     @ApiOperation(value = "将某个任务要求返工修改", httpMethod = "PUT")
-    public Response submitToRework(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
+    public Response<FileReviewStatusEnum> submitToRework(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
         return Response.buildSuccess(fileReviewService.submitInspection(fileReviewId, reviewerId, 0));
     }
 
     @PutMapping("/complete")
     @ApiOperation(value = "将某一任务结束", httpMethod = "PUT")
-    public Response submitToComplete(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
+    public Response<FileReviewStatusEnum> submitToComplete(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
         return Response.buildSuccess(fileReviewService.submitInspection(fileReviewId, reviewerId, 1));
     }
 
     @GetMapping("/hasInspected")
     @ApiOperation(value = "查看评审人员是否已提交结果", httpMethod = "GET")
-    public Response hasInspected(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
+    public Response<Boolean> hasInspected(@RequestParam("fileReviewId") int fileReviewId, @RequestParam("reviewerId") int reviewerId) {
         return Response.buildSuccess(fileReviewService.hasInspected(fileReviewId, reviewerId));
     }
 }

+ 7 - 4
web/src/main/java/cn/seecoder/web/controller/codereview/CommentController.java

@@ -3,6 +3,7 @@ package cn.seecoder.web.controller.codereview;
 import cn.seecoder.common.exceptions.ServiceException;
 import cn.seecoder.web.model.vo.Response;
 import cn.seecoder.web.model.vo.codereview.CommentCreateVO;
+import cn.seecoder.web.model.vo.codereview.CommentVO;
 import cn.seecoder.web.service.codereview.CommentService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -10,6 +11,8 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @author Zihe Chen
  * @date 2022/1/12
@@ -29,21 +32,21 @@ public class CommentController {
     @GetMapping("/{codeReviewId}")
     @ApiOperation(value = "获取一个CodeReview的所有评论", httpMethod = "GET")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response list(@PathVariable Integer codeReviewId) throws ServiceException {
+    public Response<List<CommentVO>> list(@PathVariable Integer codeReviewId) throws ServiceException {
         return Response.buildSuccess(commentService.list(codeReviewId, false));
     }
 
     @GetMapping("/listForFileReview/{fileReviewId}")
     @ApiOperation(value = "获取文件评审的所有评论", httpMethod = "GET")
     @ApiImplicitParam(value = "fileReview", dataType = "int", paramType = "query")
-    public Response listForFileReview(@PathVariable Integer fileReviewId) throws ServiceException {
+    public Response<List<CommentVO>> listForFileReview(@PathVariable Integer fileReviewId) throws ServiceException {
         return Response.buildSuccess(commentService.list(fileReviewId, true));
     }
 
     @PostMapping("/create")
     @ApiOperation(value = "创建一条新的Comment", httpMethod = "POST")
     @ApiImplicitParam(value = "commentCreateVO", dataType = "object", paramType = "body")
-    public Response create(@RequestBody CommentCreateVO commentCreateVO){
+    public Response<Object> create(@RequestBody CommentCreateVO commentCreateVO){
         commentService.create(commentCreateVO, false);
         return Response.buildSuccess();
     }
@@ -51,7 +54,7 @@ public class CommentController {
     @PostMapping("/createForFileReview")
     @ApiOperation(value = "为文件评审创建一条评论", httpMethod = "POST")
     @ApiImplicitParam(value = "commentCreateVO", dataType = "object", paramType = "body")
-    public Response createForFileReview(@RequestBody CommentCreateVO commentCreateVO) {
+    public Response<Object> createForFileReview(@RequestBody CommentCreateVO commentCreateVO) {
         commentService.create(commentCreateVO, true);
         return Response.buildSuccess();
     }

+ 1 - 1
web/src/main/java/cn/seecoder/web/controller/commit/BranchController.java

@@ -35,7 +35,7 @@ public class BranchController {
     @ApiOperation(value = "获取指定项目的所有branch信息", httpMethod = "GET")
     @GetMapping("/branch/list")
     @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
-    public Response<Object> getAllBranches(@RequestParam("projectId") Integer projectId){
+    public Response<List<BranchVO>> getAllBranches(@RequestParam("projectId") Integer projectId){
         List<BranchVO> allBranches = branchService.getAllBranches(projectId);
         if (allBranches != null) {
             return Response.buildSuccess(allBranches);

+ 9 - 9
web/src/main/java/cn/seecoder/web/controller/functest/FuncTestController.java

@@ -55,7 +55,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "title",dataType ="string", paramType = "query"),
             @ApiImplicitParam(name = "taskId", dataType = "int", paramType = "query")
     })
-    public Response createTestCase(@RequestParam("projectId") Integer projectId,@RequestParam("title") String title, @RequestParam("taskId") Integer taskId){
+    public Response<Object> createTestCase(@RequestParam("projectId") Integer projectId,@RequestParam("title") String title, @RequestParam("taskId") Integer taskId){
         funcTestService.createTestCase(projectId, title, taskId);
         return Response.buildSuccess();
     }
@@ -66,7 +66,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "title",dataType ="string", paramType = "query")
     })
     @PutMapping
-    public Response updateTestCaseTitle(@RequestParam("testCaseId") Integer testCaseId,@RequestParam("title") String title){
+    public Response<Object> updateTestCaseTitle(@RequestParam("testCaseId") Integer testCaseId,@RequestParam("title") String title){
         funcTestService.updateTestCaseTitle(testCaseId, title);
         return Response.buildSuccess();
     }
@@ -76,7 +76,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "testCaseId",dataType ="int", paramType = "query"),
     })
     @PutMapping("/finish")
-    public Response finish(@RequestParam("testCaseId") Integer testCaseId){
+    public Response<Object> finish(@RequestParam("testCaseId") Integer testCaseId){
         funcTestService.finish(testCaseId);
         return Response.buildSuccess();
     }
@@ -86,7 +86,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "testCaseId",dataType ="int", paramType = "query"),
     })
     @PutMapping("/reopen")
-    public Response reopen(@RequestParam("testCaseId") Integer testCaseId){
+    public Response<Object> reopen(@RequestParam("testCaseId") Integer testCaseId){
         funcTestService.reopen(testCaseId);
         return Response.buildSuccess();
     }
@@ -94,7 +94,7 @@ public class FuncTestController {
     @ApiOperation(value = "删除测试用例", httpMethod = "DELETE")
     @ApiImplicitParam(name = "testCaseId",dataType ="int", paramType = "query")
     @DeleteMapping
-    public Response deleteTestCase(@RequestParam("testCaseId") Integer testCaseId){
+    public Response<Object> deleteTestCase(@RequestParam("testCaseId") Integer testCaseId){
         funcTestService.deleteTestCase(testCaseId);
         return Response.buildSuccess();
     }
@@ -102,7 +102,7 @@ public class FuncTestController {
     @ApiOperation(value = "创建空的测试用例步骤", httpMethod = "POST")
     @ApiImplicitParam(name = "testCaseId",dataType ="int", paramType = "query")
     @PostMapping("/steps")
-    public Response createEmptyTestStep(@RequestParam("testCaseId") Integer testCaseId){
+    public Response<Object> createEmptyTestStep(@RequestParam("testCaseId") Integer testCaseId){
         funcTestService.createEmptyTestStep(testCaseId);
         return Response.buildSuccess();
     }
@@ -115,7 +115,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "expectation",dataType ="string", paramType = "query")
     })
     @PutMapping("/steps")
-    public Response updateTestStepInfo(@RequestParam("testStepId") Integer testStepId, @RequestParam("description") String description, @RequestParam("expectation") String expectation){
+    public Response<Object> updateTestStepInfo(@RequestParam("testStepId") Integer testStepId, @RequestParam("description") String description, @RequestParam("expectation") String expectation){
         funcTestService.updateTestStepInfo(testStepId, description, expectation);
         return Response.buildSuccess();
     }
@@ -123,7 +123,7 @@ public class FuncTestController {
     @ApiOperation(value = "删除测试用例步骤", httpMethod = "DELETE")
     @ApiImplicitParam(name = "testStepId",dataType ="int", paramType = "query")
     @DeleteMapping("/steps")
-    public Response deleteTestStep(@RequestParam("testStepId") Integer testStepId){
+    public Response<Object> deleteTestStep(@RequestParam("testStepId") Integer testStepId){
         funcTestService.deleteTestStep(testStepId);
         return Response.buildSuccess();
     }
@@ -134,7 +134,7 @@ public class FuncTestController {
             @ApiImplicitParam(name = "state",dataType ="string", paramType = "query")
     })
     @PutMapping("/steps/state")
-    public Response updateTestStepState(@RequestParam("testStepId") Integer testStepId,
+    public Response<Object> updateTestStepState(@RequestParam("testStepId") Integer testStepId,
                                         @RequestParam("state")FuncTestStepState state){
         funcTestService.updateTestStepState(testStepId, state);
         return Response.buildSuccess();

+ 1 - 1
web/src/main/java/cn/seecoder/web/controller/message/MessageController.java

@@ -41,7 +41,7 @@ public class MessageController {
     @GetMapping("/read/{messageId}")
     @ApiOperation(value = "将某条消息置为已读")
     @ApiImplicitParam(value = "messageId", dataType = "int", paramType = "query")
-    public Response readMessage(@PathVariable int messageId){
+    public Response<Object> readMessage(@PathVariable int messageId){
         messageService.readMessage(messageId);
         return Response.buildSuccess();
     }

+ 3 - 3
web/src/main/java/cn/seecoder/web/controller/pipeline/DeploymentController.java

@@ -46,7 +46,7 @@ public class DeploymentController {
             @ApiImplicitParam(name = "pipelineId", dataType ="int",paramType = "query")
     })
     @PostMapping
-    public Response deploy(@RequestParam("projectId")Integer projectId,
+    public Response<Object> deploy(@RequestParam("projectId")Integer projectId,
                            @RequestParam("pipelineId")Integer pipelineId) throws ServiceException {
         deploymentService.deploy(projectId,pipelineId, UserService.loginUser().getId());
         return Response.buildSuccess();
@@ -58,7 +58,7 @@ public class DeploymentController {
             @ApiImplicitParam(name = "pipelineId", dataType ="int",paramType = "query")
     })
     @DeleteMapping
-    public Response delete(@RequestParam("projectId")Integer projectId,
+    public Response<Object> delete(@RequestParam("projectId")Integer projectId,
                 @RequestParam("pipelineId")Integer pipelineId) throws ServiceException {
         deploymentService.delete(projectId,pipelineId);
         return Response.buildSuccess();
@@ -70,7 +70,7 @@ public class DeploymentController {
             @ApiImplicitParam(name = "pipelineId", dataType ="int",paramType = "query")
     })
     @GetMapping("/log")
-    public Response log(@RequestParam("projectId")Integer projectId,
+    public Response<String> log(@RequestParam("projectId")Integer projectId,
                            @RequestParam("pipelineId")Integer pipelineId) throws ServiceException {
         return Response.buildSuccess(deploymentService.log(projectId,pipelineId));
     }

+ 5 - 5
web/src/main/java/cn/seecoder/web/controller/project/ProjectController.java

@@ -68,7 +68,7 @@ public class ProjectController {
             @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "phone", dataType = "string", paramType = "query")
     })
-    public Response addMember(@RequestParam("projectId") Integer projectId,@RequestParam("phone") String phone) throws ServiceException {
+    public Response<Object> addMember(@RequestParam("projectId") Integer projectId,@RequestParam("phone") String phone) throws ServiceException {
         projectService.addMember(projectId, phone);
         return Response.buildSuccess();
     }
@@ -79,7 +79,7 @@ public class ProjectController {
             @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "userId", dataType = "int", paramType = "query")
     })
-    public Response addMember(@RequestParam("projectId") Integer projectId,@RequestParam("userId") Integer userId) throws ServiceException {
+    public Response<Object> addMember(@RequestParam("projectId") Integer projectId,@RequestParam("userId") Integer userId) throws ServiceException {
         projectService.addMember(projectId, userId);
         return Response.buildSuccess();
     }
@@ -87,7 +87,7 @@ public class ProjectController {
     @ApiOperation(value = "删除项目", httpMethod = "DELETE")
     @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
     @DeleteMapping
-    public Response<Object> deleteProject(@RequestParam("projectId") Integer projectId) {
+    public Response<String> deleteProject(@RequestParam("projectId") Integer projectId) {
         try{
             boolean res = projectService.deleteProject(projectId);
             if(res){
@@ -105,7 +105,7 @@ public class ProjectController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
     })
-    public Response generaterelateCode(@RequestParam("projectId") Integer projectId) {
+    public Response<String> generaterelateCode(@RequestParam("projectId") Integer projectId) {
         return Response.buildSuccess(projectService.generaterelateCode(projectId));
     }
 
@@ -115,7 +115,7 @@ public class ProjectController {
             @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "relateCode", dataType = "String", paramType = "query")
     })
-    public Response generaterelateCode(@RequestParam("projectId") Integer projectId,@RequestParam("relateCode") String relateCode) {
+    public Response<String> generaterelateCode(@RequestParam("projectId") Integer projectId,@RequestParam("relateCode") String relateCode) {
         return Response.buildSuccess(projectService.relateProjects(projectId,relateCode));
     }
 

+ 5 - 5
web/src/main/java/cn/seecoder/web/controller/tree/TreeNodesController.java

@@ -42,7 +42,7 @@ public class TreeNodesController {
     @ApiOperation(value = "插入节点", httpMethod = "POST")
     @ApiImplicitParam(value = "treeNodeCreateVO",dataType ="object", paramType = "body")
     @PostMapping("/node")
-    public Response insertTreeNode(@RequestBody TreeNodeCreateVO treeNodeCreateVO) throws ServiceException {
+    public Response<Object> insertTreeNode(@RequestBody TreeNodeCreateVO treeNodeCreateVO) throws ServiceException {
         treeNodeService.insertTreeNode(treeNodeCreateVO);
         return Response.buildSuccess();
     }
@@ -50,14 +50,14 @@ public class TreeNodesController {
     @ApiOperation(value = "根据nodeId删除节点", httpMethod = "DELETE")
     @DeleteMapping("/node/{nodeId}")
     @ApiImplicitParam(value = "nodeId",dataType ="int", paramType = "path")
-    public Response deleteTreeNode(@PathVariable int nodeId) throws ServiceException {
+    public Response<Object> deleteTreeNode(@PathVariable int nodeId) throws ServiceException {
         treeNodeService.deleteTreeNode(nodeId);
         return Response.buildSuccess();
     }
     @ApiOperation(value = "根据父节点fatherId创建一个子节点并返回", httpMethod = "POST")
     @PostMapping("/subNode/{fatherId}")
     @ApiImplicitParam(value = "fatherId",dataType ="int", paramType = "path")
-    public Response insertTreeNodeByFatherNode(@PathVariable int fatherId) throws ServiceException {
+    public Response<Object> insertTreeNodeByFatherNode(@PathVariable int fatherId) throws ServiceException {
         treeNodeService.insertTreeNodeByFatherNode(fatherId);
         return Response.buildSuccess();
     }
@@ -65,7 +65,7 @@ public class TreeNodesController {
     @ApiOperation(value = "修改节点属性", httpMethod = "PUT")
     @PutMapping("/node")
     @ApiImplicitParam(value = "treeNodeUpdateBasicVO",dataType = "object", paramType = "body")
-    public Response updateTreeNode(@RequestBody TreeNodeUpdateBasicVO treeNodeUpdateBasicVO){
+    public Response<Object> updateTreeNode(@RequestBody TreeNodeUpdateBasicVO treeNodeUpdateBasicVO){
         treeNodeService.updateTreeNode(treeNodeUpdateBasicVO);
         return Response.buildSuccess();
     }
@@ -73,7 +73,7 @@ public class TreeNodesController {
     @ApiOperation(value = "根据项目id返回某个项目所有type为task的节点", httpMethod = "GET")
     @GetMapping("/node/type/task/{projectId}")
     @ApiImplicitParam(value = "projectId",dataType = "int", paramType = "path")
-    public Response getNodesWithTaskTypeByProjectId(@PathVariable int projectId){
+    public Response<List<TreeNodeVO>> getNodesWithTaskTypeByProjectId(@PathVariable int projectId){
         List<TreeNodeVO> nodesWithTaskTypeByProjectId = treeNodeService.getNodesWithTaskTypeByProjectId(projectId);
         return Response.buildSuccess(nodesWithTaskTypeByProjectId);
     }

+ 1 - 1
web/src/main/java/cn/seecoder/web/controller/user/UserController.java

@@ -31,7 +31,7 @@ public class UserController {
     @ApiOperation(value = "创建gitlab用户", httpMethod = "POST")
     @PostMapping("/gitlab")
     @ApiImplicitParam(value = "vo",dataType = "object", paramType = "body")
-    public Response createGitlabUser(@RequestBody GitlabUserCreateVO vo) throws ServiceException {
+    public Response<Object> createGitlabUser(@RequestBody GitlabUserCreateVO vo) throws ServiceException {
         userService.createGitlabUser(vo);
         return Response.buildSuccess();
     }

+ 4 - 4
web/src/main/java/cn/seecoder/web/infrastructure/GlobalExceptionHandler.java

@@ -28,14 +28,14 @@ public class GlobalExceptionHandler {
 
     @ExceptionHandler(value = BindException.class)
     @ResponseBody
-    public Response handleResourceBindException(BindException e, WebRequest request) {
+    public Response<Object> handleResourceBindException(BindException e, WebRequest request) {
         log.warn("Validation bind failed: path={}, message={}", extractPath(request), e.getMessage());
         return Response.buildFailure(HttpStatus.SC_BAD_REQUEST, e.getMessage());
     }
 
     @ExceptionHandler(value = ConstraintViolationException.class)
     @ResponseBody
-    public Response handleResourceConstraintViolationException(ConstraintViolationException e, WebRequest request) {
+    public Response<Object> handleResourceConstraintViolationException(ConstraintViolationException e, WebRequest request) {
         log.warn("Constraint violation: path={}, message={}", extractPath(request), e.getMessage());
         return Response.buildFailure(HttpStatus.SC_BAD_REQUEST, e.getMessage());
     }
@@ -44,14 +44,14 @@ public class GlobalExceptionHandler {
 
     @ExceptionHandler(ServiceException.class)
     @ResponseBody
-    public Response serviceExceptionHandler(ServiceException e, WebRequest request){
+    public Response<Object> serviceExceptionHandler(ServiceException e, WebRequest request){
         log.error("Service exception: path={}, code={}, message={}", extractPath(request), e.getCode(), e.getMessage(), e);
         return Response.buildFailure(e.getCode(),e.getMessage());
     }
 
     @ExceptionHandler(Exception.class)
     @ResponseBody
-    public Response exceptionHandler(Exception e, WebRequest request){
+    public Response<Object> exceptionHandler(Exception e, WebRequest request){
         log.error("Unhandled exception: path={}, message={}", extractPath(request), e.getMessage(), e);
         return Response.buildFailure(503,e.getMessage());
     }

+ 2 - 2
web/src/main/java/cn/seecoder/web/model/vo/Response.java

@@ -25,7 +25,7 @@ public class Response<T> implements Serializable {
     }
 
 
-    public static Response<Object> buildSuccess() {
+    public static <T> Response<T> buildSuccess() {
         return new Response<>(200, "", null);
     }
 
@@ -34,7 +34,7 @@ public class Response<T> implements Serializable {
         return new Response<>(200, "", result);
     }
 
-    public static  Response<Object> buildFailure(Integer code, String message) {
+    public static <T> Response<T> buildFailure(Integer code, String message) {
         return new Response<>(code, message, null);
     }
 }