فهرست منبع

update interface

Miaomz 6 سال پیش
والد
کامیت
eefaed0a56

+ 12 - 9
src/main/java/com/moekr/moocoder/web/CodeMetricController.java

@@ -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>";
             }

+ 2 - 2
src/main/java/com/moekr/moocoder/web/VisualizationController.java

@@ -44,8 +44,8 @@ public class VisualizationController {
     }
 
     @GetMapping("/calc_metric")
-    public OOPMetricVO analyzeOOPMetrics(@RequestParam String project, @RequestParam String group){
-        return visualizationService.analyzeOOPMetrics(project, group);
+    public OOPMetricVO analyzeOOPMetrics(@RequestParam String projectId, @RequestParam String group){
+        return visualizationService.analyzeOOPMetrics(projectId, group);
     }
 
     @GetMapping("/query_packages")

+ 2 - 2
src/main/resources/templates/views/code_metric.html

@@ -232,7 +232,7 @@
 
         methods: {
             onSubmit() {
-                this.$http.get('/metric/code_metric?project='+this.formInline.project).then(response => {
+                this.$http.get('/metric/code_metric?projectId='+this.formInline.project).then(response => {
                     if (response.body){
                         this.scores = response.body;
 
@@ -297,7 +297,7 @@
             },
 
             checkDetailedReport() {
-                window.open('/metric/detailed_report?project=' + this.formInline.project, '_blank')
+                window.open('/metric/detailed_report?projectId=' + this.formInline.project, '_blank')
             }
         }
     })

+ 1 - 1
src/main/resources/templates/views/metric.html

@@ -65,7 +65,7 @@
     }
 
     function calcMetric(projectId, package_id) {
-        d3.json('/visual/calc_metric?project='+projectId+'&group='+package_id, function (error, metric) {
+        d3.json('/visual/calc_metric?projectId='+projectId+'&group='+package_id, function (error, metric) {
             if (error || metric == null){
                 alert('数据异常');
                 console.log(error);