|
|
|
@ -3,6 +3,7 @@ package net.educoder.ecsonar.services;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import net.educoder.ecsonar.constant.Constant;
|
|
|
|
|
import net.educoder.ecsonar.dao.CloudTaskInfoDao;
|
|
|
|
|
import net.educoder.ecsonar.dao.CloudTaskInfoDetailDao;
|
|
|
|
|
import net.educoder.ecsonar.dao.ProjectDao;
|
|
|
|
@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
@ -183,15 +185,19 @@ public class CloudBrainService {
|
|
|
|
|
/**
|
|
|
|
|
* 获取issues
|
|
|
|
|
*
|
|
|
|
|
* @param projectName
|
|
|
|
|
* @param types
|
|
|
|
|
* @param taskName 任务名称
|
|
|
|
|
* @param type 类型
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<IssuesVO> doGetIssues(String projectName, String types) {
|
|
|
|
|
private List<IssuesVO> doGetIssues(String taskName, String type) {
|
|
|
|
|
|
|
|
|
|
if (Constant.ALL.equals(type)) {
|
|
|
|
|
type = StringUtils.join(Constant.BUG, ",", Constant.VULNERABILITY, ",", Constant.CODE_SMELL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
sb.append("/api/issues/search?componentKeys=").append(projectName)
|
|
|
|
|
.append("&s=FILE_LINE&resolved=false&types=").append(types)
|
|
|
|
|
sb.append("/api/issues/search?componentKeys=").append(taskName)
|
|
|
|
|
.append("&s=FILE_LINE&resolved=false&types=").append(type)
|
|
|
|
|
.append("&ps=500&organization=default-organization&facets=severities%2Ctypes&additionalFields=_all");
|
|
|
|
|
|
|
|
|
|
String url = sonarHost + sb.toString();
|
|
|
|
@ -217,6 +223,12 @@ public class CloudBrainService {
|
|
|
|
|
return issuesVOS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取问题源代码
|
|
|
|
|
*
|
|
|
|
|
* @param component
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<SourceCodeVO> doGetSourceCode(String component) {
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|