diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java index 2f0c5c8..030470e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.dashboard.manage; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.ningdatech.pmapi.common.model.entity.DataDTO; @@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.List; import java.util.Objects; @@ -80,7 +82,11 @@ public class ProjectCostStatisticsManage { List yearMeetingIds = yearMeetings.stream().map(Meeting::getId) .collect(Collectors.toList()); //算出所有的 同意的专家 - List yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); + List yearMeetingExperts = Lists.newArrayList(); + if(CollUtil.isNotEmpty(yearMeetingIds)){ + yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); + } + reviewData.setName(thisYear.toString()); reviewData.setAmount(reviewAoumtExpert.multiply(BigDecimal .valueOf(yearMeetingExperts.size()))); @@ -91,7 +97,8 @@ public class ProjectCostStatisticsManage { reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal .valueOf(yearMeetingExperts.size()))); } - reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2))); + reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2),BigDecimal.ROUND_CEILING, + RoundingMode.HALF_UP)); twoYearsAvg.add(reviewAvg); twoYearsAvg.add(pricingAvg); res.setTwoYearsReviews(twoYearsReviews);