|
@@ -15,6 +15,7 @@ import com.nju.edu.gitlab.SeecoderGitlabApi;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -27,6 +28,7 @@ import java.util.List;
|
|
|
*/
|
|
*/
|
|
|
@Api(tags = "GitLab Hook API")
|
|
@Api(tags = "GitLab Hook API")
|
|
|
@RestController
|
|
@RestController
|
|
|
|
|
+@Slf4j
|
|
|
public class CommitController {
|
|
public class CommitController {
|
|
|
|
|
|
|
|
private final BugListService bugListService;
|
|
private final BugListService bugListService;
|
|
@@ -77,21 +79,24 @@ public class CommitController {
|
|
|
for (GitWebHookVO.Commit commit: gitWebHookVO.getCommits()){
|
|
for (GitWebHookVO.Commit commit: gitWebHookVO.getCommits()){
|
|
|
if (commitService.isResolved(commit.getId())){
|
|
if (commitService.isResolved(commit.getId())){
|
|
|
//已经解析过了
|
|
//已经解析过了
|
|
|
|
|
+ log.info("Commits 已经解析过了, id: {}", commit.getId());
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
CommitRule rule = CommitResolver.resolve(commit.getTitle());
|
|
CommitRule rule = CommitResolver.resolve(commit.getTitle());
|
|
|
if (rule == null){
|
|
if (rule == null){
|
|
|
- //不符合规范
|
|
|
|
|
|
|
+ log.info("Commits 不符合规范, id: {}", commit.getId());
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
switch (rule.getType()){
|
|
switch (rule.getType()){
|
|
|
case FEAT:
|
|
case FEAT:
|
|
|
treeNodeService.updateNodeState(rule.getId(),rule.getState());
|
|
treeNodeService.updateNodeState(rule.getId(),rule.getState());
|
|
|
commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
|
|
|
+ log.info("Commits 关联tree节点, id: {}", commit.getId());
|
|
|
break;
|
|
break;
|
|
|
case FIX:
|
|
case FIX:
|
|
|
bugListService.updateState(rule.getState(), rule.getId());
|
|
bugListService.updateState(rule.getState(), rule.getId());
|
|
|
commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
|
|
|
|
|
+ log.info("Commits 关联bug节点, id: {}", commit.getId());
|
|
|
break;
|
|
break;
|
|
|
case UNKNOWN:
|
|
case UNKNOWN:
|
|
|
break;
|
|
break;
|