refactor(工作台): 优化工作台文字显示

This commit is contained in:
guoyuqi 2024-11-29 11:25:34 +08:00 committed by Craftsman
parent f7656ca319
commit cdae1e0d83
4 changed files with 17 additions and 17 deletions

View File

@ -4,10 +4,10 @@ functional_case.hasReview=已评审
functional_case.unReview=未评审 functional_case.unReview=未评审
functional_case.passRate=通过率 functional_case.passRate=通过率
functional_case.hasPass=已通过 functional_case.hasPass=已通过
functional_case.unPass=通过 functional_case.unPass=通过
functional_case.coverRate=覆盖 functional_case.associateRate=关联
functional_case.hasCover=已覆盖 functional_case.hasAssociate=已关联
functional_case.unCover=未覆盖 functional_case.unAssociate=未关联
api_definition.completionRate=完成率 api_definition.completionRate=完成率
api_management.execTime=执行次数 api_management.execTime=执行次数
api_management.execCount=已执行 api_management.execCount=已执行

View File

@ -5,9 +5,9 @@ functional_case.unReview=Not reviewed
functional_case.passRate=Pass rate functional_case.passRate=Pass rate
functional_case.hasPass=Passed functional_case.hasPass=Passed
functional_case.unPass=Un pass functional_case.unPass=Un pass
functional_case.coverRate=Coverage functional_case.associateRate=Associate rate
functional_case.hasCover=Covered functional_case.hasAssociate=Associated
functional_case.unCover=Not covered functional_case.unAssociate=Un associate
api_definition.completionRate=Completion rate api_definition.completionRate=Completion rate
api_management.execTime=Execution times api_management.execTime=Execution times
api_management.execCount=Executed api_management.execCount=Executed

View File

@ -4,10 +4,10 @@ functional_case.hasReview=已评审
functional_case.unReview=未评审 functional_case.unReview=未评审
functional_case.passRate=通过率 functional_case.passRate=通过率
functional_case.hasPass=已通过 functional_case.hasPass=已通过
functional_case.unPass=通过 functional_case.unPass=通过
functional_case.coverRate=覆盖 functional_case.associateRate=关联
functional_case.hasCover=已覆盖 functional_case.hasAssociate=已关联
functional_case.unCover=未覆盖 functional_case.unAssociate=未关联
api_definition.completionRate=完成率 api_definition.completionRate=完成率
api_management.execTime=执行次数 api_management.execTime=执行次数
api_management.execCount=已执行 api_management.execCount=已执行

View File

@ -796,7 +796,7 @@ public class DashboardService {
} }
long caseTestCount = extFunctionalCaseMapper.caseTestCount(projectId, null, null); long caseTestCount = extFunctionalCaseMapper.caseTestCount(projectId, null, null);
long simpleCaseCount = extFunctionalCaseMapper.simpleCaseCount(projectId, null, null); long simpleCaseCount = extFunctionalCaseMapper.simpleCaseCount(projectId, null, null);
List<NameCountDTO> coverList = getCoverList((int) simpleCaseCount, (int) caseTestCount, (int) (simpleCaseCount - caseTestCount)); List<NameCountDTO> coverList = getCoverList((int) simpleCaseCount,Translator.get("functional_case.associateRate"), (int) caseTestCount,Translator.get("functional_case.hasAssociate"), (int) (simpleCaseCount - caseTestCount), Translator.get("functional_case.unAssociate"));
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>(); Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
statusStatisticsMap.put("cover", coverList); statusStatisticsMap.put("cover", coverList);
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
@ -977,7 +977,7 @@ public class DashboardService {
List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, null, null); List<FunctionalCaseStatisticDTO> statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, null, null);
List<FunctionalCaseStatisticDTO> unReviewCaseList = statisticListByProjectId.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getReviewStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString())).toList(); List<FunctionalCaseStatisticDTO> unReviewCaseList = statisticListByProjectId.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getReviewStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString())).toList();
int reviewCount = statisticListByProjectId.size() - unReviewCaseList.size(); int reviewCount = statisticListByProjectId.size() - unReviewCaseList.size();
List<NameCountDTO> coverList = getCoverList(statisticListByProjectId.size(), reviewCount, unReviewCaseList.size()); List<NameCountDTO> coverList = getCoverList(statisticListByProjectId.size(), Translator.get("functional_case.reviewRate"), reviewCount,Translator.get("functional_case.hasReview"), unReviewCaseList.size(), Translator.get("functional_case.unReview"));
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>(); Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
statusStatisticsMap.put("cover", coverList); statusStatisticsMap.put("cover", coverList);
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
@ -1082,22 +1082,22 @@ public class DashboardService {
} }
@NotNull @NotNull
private static List<NameCountDTO> getCoverList(int totalCount, int coverCount, int unCoverCount) { private static List<NameCountDTO> getCoverList(int totalCount, String rateName, int coverCount,String coverName, int unCoverCount, String unCoverName) {
List<NameCountDTO> coverList = new ArrayList<>(); List<NameCountDTO> coverList = new ArrayList<>();
NameCountDTO coverRate = new NameCountDTO(); NameCountDTO coverRate = new NameCountDTO();
if (totalCount > 0) { if (totalCount > 0) {
BigDecimal divide = BigDecimal.valueOf(coverCount).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP); BigDecimal divide = BigDecimal.valueOf(coverCount).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP);
coverRate.setCount(getTurnCount(divide)); coverRate.setCount(getTurnCount(divide));
} }
coverRate.setName(Translator.get("functional_case.coverRate")); coverRate.setName(rateName );
coverList.add(coverRate); coverList.add(coverRate);
NameCountDTO hasCover = new NameCountDTO(); NameCountDTO hasCover = new NameCountDTO();
hasCover.setCount(coverCount); hasCover.setCount(coverCount);
hasCover.setName(Translator.get("functional_case.hasCover")); hasCover.setName(coverName);
coverList.add(hasCover); coverList.add(hasCover);
NameCountDTO unCover = new NameCountDTO(); NameCountDTO unCover = new NameCountDTO();
unCover.setCount(unCoverCount); unCover.setCount(unCoverCount);
unCover.setName(Translator.get("functional_case.unCover")); unCover.setName(unCoverName);
coverList.add(unCover); coverList.add(unCover);
return coverList; return coverList;
} }