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