|
|
@@ -7,7 +7,10 @@ import com.moekr.moocoder.web.dto.CodeMetricDTO;
|
|
|
import lombok.extern.apachecommons.CommonsLog;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
@@ -32,15 +35,15 @@ public class CodeMetricController {
|
|
|
|
|
|
|
|
|
@GetMapping("/code_metric")
|
|
|
- public @ResponseBody CodeMetricDTO getCodeMetricDTO(@RequestParam String project){
|
|
|
- if (project == null) {
|
|
|
+ public @ResponseBody CodeMetricDTO getCodeMetricDTO(@RequestParam String projectId){
|
|
|
+ if (projectId == null || projectId.isEmpty()) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- CodeScaleMetricVO scaleMetricVO = codeMetricService.getCodeScaleMetric(project);
|
|
|
- PMDRelatedVO relatedVO = codeMetricService.getPMDRelatedMetric(project);
|
|
|
- ExtensionMetricVO extensionMetricVO = codeMetricService.getExtensionMetric(project);
|
|
|
- CoverageMetricVO coverageMetricVO = codeMetricService.getCoverageMetric(project);
|
|
|
+ CodeScaleMetricVO scaleMetricVO = codeMetricService.getCodeScaleMetric(projectId);
|
|
|
+ PMDRelatedVO relatedVO = codeMetricService.getPMDRelatedMetric(projectId);
|
|
|
+ ExtensionMetricVO extensionMetricVO = codeMetricService.getExtensionMetric(projectId);
|
|
|
+ CoverageMetricVO coverageMetricVO = codeMetricService.getCoverageMetric(projectId);
|
|
|
|
|
|
if (scaleMetricVO == null || relatedVO == null || extensionMetricVO == null || coverageMetricVO == null){
|
|
|
return null;
|
|
|
@@ -80,9 +83,9 @@ public class CodeMetricController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/detailed_report")
|
|
|
- public void getDetailedReport(@RequestParam String project, HttpServletResponse response) {
|
|
|
+ public void getDetailedReport(@RequestParam String projectId, HttpServletResponse response) {
|
|
|
try {
|
|
|
- String html = codeMetricService.getDetailedProject(project);
|
|
|
+ String html = codeMetricService.getDetailedProject(projectId);
|
|
|
if (html == null || html.isEmpty()) {
|
|
|
html = "<html><head><meta charset=\"UTF-8\"></head><body><p>项目不存在!</p><p><a href='/code_metric'>返回代码度量页面</a></p></body></html>";
|
|
|
}
|