diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java index 3112df3356..71b096ca0f 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java @@ -16,15 +16,15 @@ public class TopicSummaryInfoResultDTO implements Serializable { /** * 名称 */ - private String name; + private String name = ""; /** * 值 */ - private Integer value; + private Integer value = 0; /** * 百分比 */ - private String ratio; + private String ratio = "0.0%"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java index 6f14a45fd5..c59017335b 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java @@ -16,27 +16,27 @@ public class TopicSummaryResultDTO implements Serializable { /** * 话题总数 */ - private Integer topicTotalCount; + private Integer topicTotalCount = 0; /** * 讨论中话题数量 */ - private Integer talkingTotalCount; + private Integer talkingTotalCount = 0; /** * 已关闭话题数量 */ - private Integer closedTotalCount; + private Integer closedTotalCount = 0; /** * 已屏蔽话题数量 */ - private Integer shieldedTotalCount; + private Integer shieldedTotalCount = 0; /** * 话题已转议题数量 */ - private Integer shiftedTotalCount; + private Integer shiftedTotalCount = 0; /** * 数据更新至 时间 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 ad8d8e7eee..f63d887dd9 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.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -39,6 +40,7 @@ public class TopicServiceImpl implements TopicService { TopicSummaryResultDTO result = new TopicSummaryResultDTO(); String agencyId = this.getLoginUserDetails(tokenDto); List topicStatus = topicDao.getTopicStatus(agencyId); + result.setDeadline(LocalDate.now().minusDays(NumConstant.ONE).toString()); if (topicStatus.size() != NumConstant.ZERO){ topicStatus.forEach(topic -> { if (topic.getTopicStatus().equals(TopicConstant.DISCUSSING)){ @@ -50,11 +52,11 @@ public class TopicServiceImpl implements TopicService { } }); result.setTopicTotalCount(topicStatus.stream().collect(Collectors.summingInt(TopicStatusResultDTO::getTopicCount))); - } - TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); - if (shiftedCount != null){ - result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); - result.setDeadline(shiftedCount.getDeadline()); + TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); + if (shiftedCount != null){ + result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); + result.setDeadline(shiftedCount.getDeadline()); + } } return result; } @@ -178,14 +180,16 @@ public class TopicServiceImpl implements TopicService { String agencyId = this.getLoginUserDetails(tokenDto); List topicSummaryInfo = topicDao.topicSummaryInfo(agencyId); TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); - Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); - String ratio; - ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : ((float)shiftedCount.getShiftedIssueCount() / (float)collect) * NumConstant.ONE_HUNDRED + TopicConstant.RATIO; - TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); - result.setName(TopicConstant.SHIFTED); - result.setRatio(ratio); - result.setValue(shiftedCount.getShiftedIssueCount()); - topicSummaryInfo.add(result); + if (topicSummaryInfo.size() != NumConstant.ZERO && shiftedCount != null) { + Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); + String ratio; + ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : ((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED + TopicConstant.RATIO; + TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); + result.setName(TopicConstant.SHIFTED); + result.setRatio(ratio); + result.setValue(shiftedCount.getShiftedIssueCount()); + topicSummaryInfo.add(result); + } return topicSummaryInfo; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml index 47b42695ee..008dc0175f 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml @@ -28,6 +28,7 @@ WHERE del_flag = '0' AND pid = #{agencyId} + AND agency_dim_type = 'all'