diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index f63d887dd9..3b81c15cfa 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.text.DecimalFormat; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -182,8 +183,9 @@ public class TopicServiceImpl implements TopicService { TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); if (topicSummaryInfo.size() != NumConstant.ZERO && shiftedCount != null) { Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); + DecimalFormat decimalFormat = new DecimalFormat(".00"); String ratio; - ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : ((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED + TopicConstant.RATIO; + ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : decimalFormat.format(((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED) + TopicConstant.RATIO; TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); result.setName(TopicConstant.SHIFTED); result.setRatio(ratio);