fix(报表统计): 调整报表统计的柱状图宽度

调整报表统计的柱状图宽度
This commit is contained in:
song-tianyang 2021-10-25 10:26:29 +08:00 committed by song-tianyang
parent 1a4cc18380
commit 22904097f6
3 changed files with 45 additions and 1 deletions

View File

@ -17,4 +17,5 @@ public class Series {
private String stack;
private JSONObject encode;
private List<String> center;
private String barWidth = null;
}

View File

@ -265,6 +265,31 @@ public class TestCaseCountService {
loadCaseCount = extTestCaseCountMapper.getLoadCaseCount(request);
}
//默认值判断 用例类型为 接口功能性能 但是只查出了接口用例那么功能性能
if(request.getFilterSearchList() != null){
List<String> xaxisColumnsList = new ArrayList<>();
if(request.getFilterSearchList().containsKey(request.getXaxis())){
xaxisColumnsList = request.getFilterSearchList().get(request.getXaxis());
if(CollectionUtils.isNotEmpty(xaxisColumnsList)){
for (String xcolum : xaxisColumnsList) {
functionCaseCountResult = this.checkCountChartResultHasColumn(xcolum,functionCaseCountResult);
apiCaseCountResult = this.checkCountChartResultHasColumn(xcolum,apiCaseCountResult);
scenarioCaseCount = this.checkCountChartResultHasColumn(xcolum,scenarioCaseCount);
loadCaseCount = this.checkCountChartResultHasColumn(xcolum,loadCaseCount);
}
}
}else if(StringUtils.equalsIgnoreCase(request.getXaxis(),"caseType")){
functionCaseCountResult = this.checkCountChartResultHasColumn("功能用例",functionCaseCountResult);
apiCaseCountResult = this.checkCountChartResultHasColumn("接口用例",apiCaseCountResult);
scenarioCaseCount = this.checkCountChartResultHasColumn("场景用例",scenarioCaseCount);
loadCaseCount = this.checkCountChartResultHasColumn("性能用例",loadCaseCount);
}
}
Map<String, TestCaseCountSummary> summaryMap = this.summaryCountResult(parseUser, parseStatus,request.getProjectId(),request.getOrder(),
functionCaseCountResult, apiCaseCountResult, scenarioCaseCount, loadCaseCount);
@ -280,6 +305,23 @@ public class TestCaseCountService {
return testCaseCountResult;
}
private List<TestCaseCountChartResult> checkCountChartResultHasColumn(String xcolumn,List<TestCaseCountChartResult> resultList) {
boolean hasResult = false;
for (TestCaseCountChartResult result: resultList) {
if(StringUtils.equals(result.getGroupName(),xcolumn)){
hasResult = true;
break;
}
}
if(!hasResult){
TestCaseCountChartResult result = new TestCaseCountChartResult();
result.setCountNum(0);
result.setGroupName(xcolumn);
resultList.add(result);
}
return resultList;
}
private void formatPieChart(PieChartDTO pieChartDTO, String groupName, Map<String, TestCaseCountSummary> summaryMap,
boolean selectTestCase, boolean selectApi, boolean selectScenarioCase, boolean selectLoad) {
JSONArray titleArray = new JSONArray();
@ -573,6 +615,7 @@ public class TestCaseCountService {
tetcaseSeries.setType("bar");
tetcaseSeries.setStack("total");
tetcaseSeries.setData(testCaseCountList);
tetcaseSeries.setBarWidth("50");
seriesList.add(tetcaseSeries);
Series apiSeries = new Series();

View File

@ -174,7 +174,7 @@
}
this.dataOption.series.forEach(item => {
item.type = this.chartType;
})
});
this.reload();
},
reload() {