Kaynağa Gözat

feat: Devcloud新增Bug和TreeNode两项信息

181250114 4 yıl önce
ebeveyn
işleme
c61fb9adc0

+ 136 - 0
src/main/java/com/seecoder/dataanalysis/analysis/impl/DevcloudDataAnalysisServiceImpl.java

@@ -598,11 +598,17 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
         Commit commit = new Commit();
         Test test = new Test();
         Pipeline pipeline = new Pipeline();
+        //新增
+        Bug bugList = new Bug();
+        TreeNode treeNode = new TreeNode();
 
         Integer commit_times=0,valid_commit_time=0,buglist_commit=0,feature_commit=0;
         List<String> commit_msg_overview = new ArrayList<>();
         Integer test_success=0,test_failure=0,test_times=0,test_concurrency_count=0;
         Integer pipeline_deploy=0,pipeline_pass=0,pipeline_failure=0;
+        //新增bugList和TreeNode
+        Integer bug_times=0,high_times=0,finished_times=0;
+        Integer treeNode_times=0,high_treeNode_times=0,finished_treeNode_times=0;
         //遍历所有相关项目
         for(int i=0;i<projectList.size();i++){
             Integer projectId = projectList.get(i);
@@ -661,6 +667,36 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
                     }
                 }
             }
+            //遍历devInfo中的bugList信息
+            List<BugInfo> bugInfos = devcloudInfo.getBugList();
+            for(BugInfo bugInfo : bugInfos){
+                if(bugInfo.getUserId() == null){
+                    continue;
+                }else if(bugInfo.getUserId().equals(user_id)){
+                    bug_times++;
+                    if(bugInfo.getPriority().toLowerCase().equals("high")){
+                        high_times++;
+                    }
+                    if(bugInfo.getBugState().toLowerCase().equals("finished")){
+                        finished_times++;
+                    }
+                }
+            }
+            //遍历devInfo的treeNode信息
+            List<TreeNodeInfo> treeNodeInfos = devcloudInfo.getTreeNodeList();
+            for(TreeNodeInfo treeNodeInfo : treeNodeInfos){
+                if(treeNodeInfo.getUserId() == null){
+                    continue;
+                }else if(treeNodeInfo.getUserId().equals(user_id)){
+                    treeNode_times++;
+                    if(treeNodeInfo.getPriority().toLowerCase().equals("high")){
+                        high_treeNode_times++;
+                    }
+                    if(treeNodeInfo.getState().toLowerCase().equals("finished")){
+                        finished_treeNode_times++;
+                    }
+                }
+            }
         }
 
         //commit
@@ -678,10 +714,20 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
         pipeline.setPipeline_deploy(pipeline_deploy);
         pipeline.setPipeline_pass(pipeline_pass);
         pipeline.setPipline_failure(pipeline_failure);
+        //bugList
+        bugList.setBug_times(bug_times);
+        bugList.setHigh_times(high_times);
+        bugList.setFinished_times(finished_times);
+        //treeNode
+        treeNode.setTreeNode_times(treeNode_times);
+        treeNode.setHigh_treeNode_times(high_treeNode_times);
+        treeNode.setFinished_treeNode_times(finished_treeNode_times);
 
         formatStudent.setCommit(commit);
         formatStudent.setTest(test);
         formatStudent.setPipeline(pipeline);
+        formatStudent.setBuglist(bugList);
+        formatStudent.setTreeNode(treeNode);
 
         return formatStudent;
     }
@@ -730,6 +776,9 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
         Commit commit = new Commit();
         Test test = new Test();
         Pipeline pipeline = new Pipeline();
+        //新增
+        Bug bugList = new Bug();
+        TreeNode treeNode = new TreeNode();
 
         Integer commit_times=0,valid_commit_time=0,buglist_commit=0,feature_commit=0;
         //记录小组不同成员的commit贡献
@@ -741,6 +790,13 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
         Integer pipeline_deploy=0,pipeline_pass=0,pipeline_failure=0;
         //记录小组不同成员的deploy贡献
         int[] pipeTimes = new int[n];
+        //新增bugList,treeNode
+        Integer bug_times=0,high_times=0,finished_times=0;
+        //记录小组不同成员的bugList贡献
+        int[] bugTimes = new int[n];
+        Integer treeNode_times=0,high_treeNode_times=0,finished_treeNode_times=0;
+        //记录小组不同成员的treeNode贡献
+        int[] treeNodeTimes = new int[n];
 
         //
         for(int i=0;i<projects.size();i++){
@@ -820,6 +876,46 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
                     }
                 }
             }
+
+            //遍历devInfo中的bugList信息
+            List<BugInfo> bugInfos = devcloudInfo.getBugList();
+            for(BugInfo bugInfo : bugInfos){
+                for(int j=0;j<userIds.size();j++){
+                    Integer user_id = userIds.get(j);
+                    if(bugInfo.getUserId() == null){
+                        continue;
+                    }else if(bugInfo.getUserId().equals(user_id)){
+                        bugTimes[j]++;
+                        bug_times++;
+                        if(bugInfo.getPriority().toLowerCase().equals("high")){
+                            high_times++;
+                        }
+                        if(bugInfo.getBugState().toLowerCase().equals("finished")){
+                            finished_times++;
+                        }
+                    }
+                }
+            }
+
+            //遍历devInfo的treeNode信息
+            List<TreeNodeInfo> treeNodeInfos = devcloudInfo.getTreeNodeList();
+            for(TreeNodeInfo treeNodeInfo : treeNodeInfos){
+                for(int j=0;j<userIds.size();j++){
+                    Integer user_id = userIds.get(j);
+                    if(treeNodeInfo.getUserId() == null){
+                        continue;
+                    }else if(treeNodeInfo.getUserId().equals(user_id)){
+                        treeNodeTimes[j]++;
+                        treeNode_times++;
+                        if(treeNodeInfo.getPriority().toLowerCase().equals("high")){
+                            high_treeNode_times++;
+                        }
+                        if(treeNodeInfo.getState().toLowerCase().equals("finished")){
+                            finished_treeNode_times++;
+                        }
+                    }
+                }
+            }
         }
 
         DecimalFormat df = new DecimalFormat("#.00");
@@ -883,10 +979,50 @@ public class DevcloudDataAnalysisServiceImpl implements DevcloudDataAnalysisServ
             deployContribution.add(contribution);
         }
         pipeline.setPipeline_contribution(deployContribution);
+        //bugList
+        bugList.setBug_times(bug_times);
+        bugList.setHigh_times(high_times);
+        bugList.setFinished_times(finished_times);
+        List<Contribution> bugContribution = new ArrayList<>();
+        for(int i=0;i<userIds.size();i++){
+            Contribution contribution = new Contribution();
+            contribution.setName(users.get(i).getName());
+            contribution.setTimes(bugTimes[i]);
+            Double value;
+            if(bug_times == 0){
+                value = 0.0;
+            }else {
+                value = (double)bugTimes[i]/(double)bug_times;
+            }
+            contribution.setProportion(Double.valueOf(df.format(value)));
+            bugContribution.add(contribution);
+        }
+        bugList.setBug_contribution(bugContribution);
+        //treeNode
+        treeNode.setTreeNode_times(treeNode_times);
+        treeNode.setHigh_treeNode_times(high_treeNode_times);
+        treeNode.setFinished_treeNode_times(finished_treeNode_times);
+        List<Contribution> treeNodeContribution = new ArrayList<>();
+        for(int i=0;i<userIds.size();i++){
+            Contribution contribution = new Contribution();
+            contribution.setName(users.get(i).getName());
+            contribution.setTimes(treeNodeTimes[i]);
+            Double value;
+            if(bug_times == 0){
+                value = 0.0;
+            }else {
+                value = (double)treeNodeTimes[i]/(double)treeNode_times;
+            }
+            contribution.setProportion(Double.valueOf(df.format(value)));
+            treeNodeContribution.add(contribution);
+        }
+        treeNode.setTreeNode_contribution(treeNodeContribution);
 
         formatGroup.setCommit(commit);
         formatGroup.setTest(test);
         formatGroup.setPipeline(pipeline);
+        formatGroup.setBuglist(bugList);
+        formatGroup.setTreeNode(treeNode);
 
         return formatGroup;
     }

+ 41 - 0
src/main/java/com/seecoder/dataanalysis/data/entity/devcloud/display/Bug.java

@@ -0,0 +1,41 @@
+package com.seecoder.dataanalysis.data.entity.devcloud.display;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 用于展示BUG_LIST分析结果的类
+ */
+@AllArgsConstructor
+@Accessors(chain = true)
+@Data
+public class Bug {
+
+    /**
+     * bug_list的数目
+     */
+    private Integer bug_times;
+
+    /**
+     * 高优先级bug的数目
+     */
+    private Integer high_times;
+
+    /**
+     * 已经完成的bug数目
+     */
+    private Integer finished_times;
+
+    /**
+     * bug_list贡献占比(小组中)
+     */
+    private List<Contribution> bug_contribution;
+
+    public Bug(){
+        this.bug_contribution = new ArrayList<>();
+    }
+}

+ 10 - 0
src/main/java/com/seecoder/dataanalysis/data/entity/devcloud/display/FormatGroup.java

@@ -48,6 +48,16 @@ public class FormatGroup {
      */
     private Pipeline pipeline;
 
+    /**
+     * 小组bugList信息
+     */
+    private Bug buglist;
+
+    /**
+     * 小组需求树信息
+     */
+    private TreeNode treeNode;
+
 
     public FormatGroup(){
         this.projects = new ArrayList<>();

+ 10 - 0
src/main/java/com/seecoder/dataanalysis/data/entity/devcloud/display/FormatStudent.java

@@ -57,6 +57,16 @@ public class FormatStudent {
      */
     private Pipeline pipeline;
 
+    /**
+     * 个人bugList信息
+     */
+    private Bug buglist;
+
+    /**
+     * 个人需求树信息
+     */
+    private TreeNode treeNode;
+
 
     public FormatStudent(){
         this.projects = new ArrayList<>();

+ 39 - 0
src/main/java/com/seecoder/dataanalysis/data/entity/devcloud/display/TreeNode.java

@@ -0,0 +1,39 @@
+package com.seecoder.dataanalysis.data.entity.devcloud.display;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@AllArgsConstructor
+@Accessors(chain = true)
+@Data
+public class TreeNode {
+
+    /**
+     * tree_node的数目
+     */
+    private Integer treeNode_times;
+
+    /**
+     * 高优先级TreeNode的数目
+     */
+    private Integer high_treeNode_times;
+
+    /**
+     * 已经完成的TreeNode数目
+     */
+    private Integer finished_treeNode_times;
+
+    /**
+     * TreeNode贡献占比(小组中)
+     */
+    private List<Contribution> treeNode_contribution;
+
+    public TreeNode(){
+        this.treeNode_contribution = new ArrayList<>();
+    }
+}