From d5faf0c85042336f1b185e590abebbd69579d24c Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 13 Oct 2023 17:33:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A9=E6=95=88=E6=94=B9=E4=B8=BA=E6=98=9F?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/handle/CockpitStatsHandler.java | 10 +-- .../scheduler/task/CockpitStatsStatisticsTask.java | 77 +++++++++++++++------- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java index 1f755f1..4ab1a74 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java @@ -65,11 +65,11 @@ public class CockpitStatsHandler { private List convertTops(CockpitStats cockpitStats) { List tops = Lists.newArrayList(); - tops.add(new CockpitStatsVO.PerformanceTop("top1",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); - tops.add(new CockpitStatsVO.PerformanceTop("top2",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); - tops.add(new CockpitStatsVO.PerformanceTop("top3",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); - tops.add(new CockpitStatsVO.PerformanceTop("top4",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); - tops.add(new CockpitStatsVO.PerformanceTop("top5",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); + tops.add(new CockpitStatsVO.PerformanceTop("一星",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); + tops.add(new CockpitStatsVO.PerformanceTop("二星",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); + tops.add(new CockpitStatsVO.PerformanceTop("三星",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); + tops.add(new CockpitStatsVO.PerformanceTop("四星",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); + tops.add(new CockpitStatsVO.PerformanceTop("五星",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); return tops; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java index 4f531cb..2b3503d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java @@ -317,7 +317,8 @@ public class CockpitStatsStatisticsTask { }).collect(Collectors.toList()); List inAccpetCodes = inAccpetProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); List performances = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(PerformanceAppraisalProject::getProjectCode, inAccpetCodes) + .in(CollUtil.isNotEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, inAccpetCodes) + .in(CollUtil.isEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) .isNotNull(PerformanceAppraisalProject::getVerifyTotalScore)); cockpitStats.setProjectsTotalAccept(inAccpetProjects.size() - performances.size()); cockpitStats.setProjectsTotalPerformance(performances.size()); @@ -388,34 +389,60 @@ public class CockpitStatsStatisticsTask { return Boolean.FALSE; }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) .collect(Collectors.toList()); + + List start5 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start4 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(80)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start3 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(60)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start2 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(40)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); + List start1 = performanceAll.stream().filter(p -> { + if (Objects.nonNull(p.getVerifyTotalScore()) + && p.getVerifyTotalScore().compareTo(BigDecimal.ZERO) >= 0 + && p.getVerifyTotalScore().compareTo(BigDecimal.valueOf(20)) < 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).sorted(Comparator.comparing(PerformanceAppraisalProject::getVerifyTotalScore).reversed()) + .collect(Collectors.toList()); cockpitStats.setPerformanceTotal(performanceAll.size()); cockpitStats.setPerformanceReviewedTotal(verified.size()); cockpitStats.setPerformanceTobeReviewTotal(performanceAll.size() - verified.size()); - if(verified.size() > 0){ - cockpitStats.setPerformanceTop1Name(projectMap.get(verified.get(0).getProjectCode())); - cockpitStats.setPerformanceTop1Score(verified.get(0).getVerifyTotalScore()); - } - - if(verified.size() > 1){ - cockpitStats.setPerformanceTop2Name(verified.get(1).getProjectCode()); - cockpitStats.setPerformanceTop2Score(verified.get(1).getVerifyTotalScore()); - } - - if(verified.size() > 2){ - cockpitStats.setPerformanceTop3Name(verified.get(2).getProjectCode()); - cockpitStats.setPerformanceTop3Score(verified.get(2).getVerifyTotalScore()); - } - - if(verified.size() > 3){ - cockpitStats.setPerformanceTop4Name(verified.get(3).getProjectCode()); - cockpitStats.setPerformanceTop4Score(verified.get(3).getVerifyTotalScore()); - } - - if(verified.size() > 4){ - cockpitStats.setPerformanceTop5Name(verified.get(4).getProjectCode()); - cockpitStats.setPerformanceTop5Score(verified.get(4).getVerifyTotalScore()); - } + cockpitStats.setPerformanceTop1Score(BigDecimal.valueOf(start1.size())); + cockpitStats.setPerformanceTop2Score(BigDecimal.valueOf(start2.size())); + cockpitStats.setPerformanceTop3Score(BigDecimal.valueOf(start3.size())); + cockpitStats.setPerformanceTop4Score(BigDecimal.valueOf(start4.size())); + cockpitStats.setPerformanceTop5Score(BigDecimal.valueOf(start5.size())); } return cockpitStats;