|
|
@@ -6,6 +6,8 @@ import cn.seecoder.web.core.commit.model.CommitRule;
|
|
|
import cn.seecoder.web.model.enums.CommitRelatedEnum;
|
|
|
import cn.seecoder.web.model.po.project.CommitPO;
|
|
|
import cn.seecoder.web.model.vo.GitWebHookVO;
|
|
|
+import cn.seecoder.web.model.vo.Response;
|
|
|
+import cn.seecoder.web.model.vo.project.CommitVO;
|
|
|
import cn.seecoder.web.service.bug_list.BugListService;
|
|
|
import cn.seecoder.web.service.project.CommitService;
|
|
|
import cn.seecoder.web.service.tree.TreeNodeService;
|
|
|
@@ -14,10 +16,9 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author chenyz
|
|
|
@@ -26,7 +27,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
*/
|
|
|
@Api(tags = "GitLab Hook API")
|
|
|
@RestController
|
|
|
-@RequestMapping("/hook")
|
|
|
public class HookController {
|
|
|
|
|
|
private final BugListService bugListService;
|
|
|
@@ -58,7 +58,7 @@ public class HookController {
|
|
|
* 所有分支的push都分析
|
|
|
*/
|
|
|
@ApiOperation(value = "push回调接口", httpMethod = "POST")
|
|
|
- @PostMapping
|
|
|
+ @PostMapping("/hook")
|
|
|
@ApiImplicitParam(name = "gitWebHookVO",dataType = "object", paramType = "body")
|
|
|
public void pushHook(@RequestBody GitWebHookVO gitWebHookVO) throws ServiceException {
|
|
|
|
|
|
@@ -87,15 +87,30 @@ public class HookController {
|
|
|
switch (rule.getType()){
|
|
|
case FEAT:
|
|
|
treeNodeService.updateNodeState(rule.getId(),rule.getState());
|
|
|
- commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID));
|
|
|
+ commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
|
break;
|
|
|
case FIX:
|
|
|
bugListService.updateState(rule.getState(), rule.getId());
|
|
|
- commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID));
|
|
|
+ commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
|
break;
|
|
|
case UNKNOWN:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取某个需求树结点的所有commit信息", httpMethod = "GET")
|
|
|
+ @GetMapping("/commits/tree")
|
|
|
+ @ApiImplicitParam(name = "treeId",dataType = "int", paramType = "query")
|
|
|
+ public Response<List<CommitVO>> getTreeCommits(@RequestParam("treeId") Integer treeId){
|
|
|
+ return Response.buildSuccess(commitService.getTreeCommit(treeId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取bug list中一个bug关联的所有commit信息", httpMethod = "GET")
|
|
|
+ @GetMapping("/commits/bug_list")
|
|
|
+ @ApiImplicitParam(name = "bugId",dataType = "int", paramType = "query")
|
|
|
+ public Response<List<CommitVO>> getBugCommits(@RequestParam("bugId") Integer bugId){
|
|
|
+ return Response.buildSuccess(commitService.getBugCommit(bugId));
|
|
|
+ }
|
|
|
+
|
|
|
}
|