|
|
@@ -6,11 +6,14 @@ import cn.seecoder.web.dao.user.UserMapper;
|
|
|
import cn.seecoder.web.model.enums.CommitRelatedEnum;
|
|
|
import cn.seecoder.web.model.vo.project.CommitVO;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabApi;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import cn.seecoder.web.dao.project.CommitMapper;
|
|
|
import cn.seecoder.web.model.po.project.CommitPO;
|
|
|
import cn.seecoder.web.service.project.CommitService;
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabApi;
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabException;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -24,11 +27,13 @@ import java.util.stream.Collectors;
|
|
|
public class CommitServiceImpl implements CommitService {
|
|
|
|
|
|
private final CommitMapper commitMapper;
|
|
|
+ private final SeecoderGitlabApi seecoderGitlabApi;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
- public CommitServiceImpl(CommitMapper commitMapper) {
|
|
|
+ public CommitServiceImpl(CommitMapper commitMapper, SeecoderGitlabApi seecoderGitlabApi) {
|
|
|
this.commitMapper = commitMapper;
|
|
|
+ this.seecoderGitlabApi = seecoderGitlabApi;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
@@ -70,4 +75,20 @@ public class CommitServiceImpl implements CommitService {
|
|
|
.map(CommitVO::new)
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<com.nju.edu.gitlab.vo.commit.CommitVO> getCommitsByBranchName(Integer projectId, String BranchName) {
|
|
|
+ List<com.nju.edu.gitlab.vo.commit.CommitVO> allCommits;
|
|
|
+
|
|
|
+ //TODO
|
|
|
+ try{
|
|
|
+ allCommits = seecoderGitlabApi.getCommitsByBranch(projectId, "master");
|
|
|
+
|
|
|
+ } catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return allCommits;
|
|
|
+ }
|
|
|
}
|