Browse Source

话题

master
zxc 5 years ago
parent
commit
b0f912f089
  1. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

4
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);

Loading…
Cancel
Save