From e8790e9f0970cd190c928edeed0752883b93ad41 Mon Sep 17 00:00:00 2001
From: youys <1272586223@qq.com>
Date: Wed, 6 Jul 2022 16:52:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E8=84=91=E4=BB=A3=E7=A0=81=E8=B4=A8?=
=?UTF-8?q?=E9=87=8F=E5=88=86=E6=9E=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 6 +
.../educoder/ecsonar/constant/Constant.java | 6 +
.../controller/CloudBrainController.java | 52 ++++++-
.../ecsonar/dao/CloudTaskInfoDao.java | 2 +-
.../ecsonar/dao/CloudTaskInfoDetailDao.java | 16 ++
.../net/educoder/ecsonar/dao/ProjectDao.java | 10 ++
.../educoder/ecsonar/model/IssuesMetrics.java | 46 ++++++
.../vo/CloudQualityInspectMetricsVO.java | 81 ++++++++++
.../model/vo/CloudQualityInspectResultVO.java | 43 ++++++
.../ecsonar/model/vo/IssuesSearchVO.java | 37 +++++
.../educoder/ecsonar/model/vo/IssuesVO.java | 55 +++++++
.../ecsonar/model/vo/SourceCodeVO.java | 28 ++++
.../ecsonar/services/CloudBrainService.java | 146 +++++++++++++++++-
src/main/resources/application.properties | 4 +-
14 files changed, 520 insertions(+), 12 deletions(-)
create mode 100644 src/main/java/net/educoder/ecsonar/model/IssuesMetrics.java
create mode 100644 src/main/java/net/educoder/ecsonar/model/vo/CloudQualityInspectMetricsVO.java
create mode 100644 src/main/java/net/educoder/ecsonar/model/vo/CloudQualityInspectResultVO.java
create mode 100644 src/main/java/net/educoder/ecsonar/model/vo/IssuesSearchVO.java
create mode 100644 src/main/java/net/educoder/ecsonar/model/vo/IssuesVO.java
create mode 100644 src/main/java/net/educoder/ecsonar/model/vo/SourceCodeVO.java
diff --git a/pom.xml b/pom.xml
index 62f400a..1fce790 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,12 @@
5.7.19
+
+ cn.hutool
+ hutool-http
+ 5.7.19
+
+
com.alibaba
fastjson
diff --git a/src/main/java/net/educoder/ecsonar/constant/Constant.java b/src/main/java/net/educoder/ecsonar/constant/Constant.java
index 26d24e6..d70d37e 100644
--- a/src/main/java/net/educoder/ecsonar/constant/Constant.java
+++ b/src/main/java/net/educoder/ecsonar/constant/Constant.java
@@ -19,4 +19,10 @@ public class Constant {
public static final List language = Arrays.asList(JAVA, C, CXX, PYTHON);
public static final String SUCCESS = "SUCCESS";
+
+
+ public static final String BUG = "BUG";
+ public static final String VULNERABILITY = "VULNERABILITY";
+ public static final String CODE_SMELL = "CODE_SMELL";
+ public static final String SECURITY_HOTSPOT = "SECURITY_HOTSPOT";
}
diff --git a/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java b/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java
index dfd2f19..73ec300 100644
--- a/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java
+++ b/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java
@@ -3,7 +3,7 @@ package net.educoder.ecsonar.controller;
import com.alibaba.fastjson.JSONObject;
import net.educoder.ecsonar.model.api.QualityInspect;
import net.educoder.ecsonar.model.api.QualityInspectIsCompleted;
-import net.educoder.ecsonar.model.vo.CloudBrainQualityInspectVO;
+import net.educoder.ecsonar.model.vo.*;
import net.educoder.ecsonar.services.CloudBrainService;
import net.educoder.ecsonar.utils.ResponseResult;
import org.apache.commons.collections4.CollectionUtils;
@@ -12,7 +12,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @Author: youys
@@ -28,10 +30,16 @@ public class CloudBrainController {
@Autowired
private CloudBrainService cloudBrainService;
+ /**
+ * 云脑代码质量检测
+ *
+ * @param cloudBrainQualityInspectVO
+ * @return
+ */
@PostMapping("/cloudQualityInspect")
public ResponseResult cloudQualityInspect(@RequestBody List cloudBrainQualityInspectVO) {
logger.info("cloudQualityInspect请求参数:{}", JSONObject.toJSONString(cloudBrainQualityInspectVO));
- if(CollectionUtils.isEmpty(cloudBrainQualityInspectVO)){
+ if (CollectionUtils.isEmpty(cloudBrainQualityInspectVO)) {
ResponseResult.error("参数不能为空");
}
QualityInspect qualityInspect = cloudBrainService.startQualityInspect(cloudBrainQualityInspectVO);
@@ -40,13 +48,45 @@ public class CloudBrainController {
/**
- * 质量检测任务是否完成
+ * 检测结果查询
+ *
* @param taskId
* @return
*/
- @GetMapping(value = "/cloudQualityInspectIsCompleted/{taskId}")
- public ResponseResult cloudQualityInspectIsCompleted(@PathVariable String taskId){
- QualityInspectIsCompleted result = cloudBrainService.cloudQualityInspectIsCompleted(taskId);
+ @GetMapping(value = "/cloudQualityInspectResult")
+ public ResponseResult cloudQualityInspectResult(@RequestParam String taskId) {
+ CloudQualityInspectResultVO result = cloudBrainService.cloudQualityInspectResult(taskId);
+ return ResponseResult.success(result);
+ }
+
+
+ /**
+ * issues详情查询
+ *
+ * @param searchVO
+ * @return
+ */
+ @GetMapping(value = "/issues/search")
+ public ResponseResult issuesSearch(IssuesSearchVO searchVO) {
+ List result = cloudBrainService.issuesSearch(searchVO);
+ return ResponseResult.success(result);
+ }
+
+
+ /**
+ * 获取源码
+ *
+ * @param component
+ * @return
+ */
+ @GetMapping(value = "/getSourceCode")
+ public ResponseResult