|
@ -14,6 +14,7 @@ import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -39,6 +40,7 @@ public class TopicServiceImpl implements TopicService { |
|
|
TopicSummaryResultDTO result = new TopicSummaryResultDTO(); |
|
|
TopicSummaryResultDTO result = new TopicSummaryResultDTO(); |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
List<TopicStatusResultDTO> topicStatus = topicDao.getTopicStatus(agencyId); |
|
|
List<TopicStatusResultDTO> topicStatus = topicDao.getTopicStatus(agencyId); |
|
|
|
|
|
result.setDeadline(LocalDate.now().minusDays(NumConstant.ONE).toString()); |
|
|
if (topicStatus.size() != NumConstant.ZERO){ |
|
|
if (topicStatus.size() != NumConstant.ZERO){ |
|
|
topicStatus.forEach(topic -> { |
|
|
topicStatus.forEach(topic -> { |
|
|
if (topic.getTopicStatus().equals(TopicConstant.DISCUSSING)){ |
|
|
if (topic.getTopicStatus().equals(TopicConstant.DISCUSSING)){ |
|
@ -50,12 +52,12 @@ public class TopicServiceImpl implements TopicService { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
result.setTopicTotalCount(topicStatus.stream().collect(Collectors.summingInt(TopicStatusResultDTO::getTopicCount))); |
|
|
result.setTopicTotalCount(topicStatus.stream().collect(Collectors.summingInt(TopicStatusResultDTO::getTopicCount))); |
|
|
} |
|
|
|
|
|
TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); |
|
|
TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); |
|
|
if (shiftedCount != null){ |
|
|
if (shiftedCount != null){ |
|
|
result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); |
|
|
result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); |
|
|
result.setDeadline(shiftedCount.getDeadline()); |
|
|
result.setDeadline(shiftedCount.getDeadline()); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -178,14 +180,16 @@ public class TopicServiceImpl implements TopicService { |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
List<TopicSummaryInfoResultDTO> topicSummaryInfo = topicDao.topicSummaryInfo(agencyId); |
|
|
List<TopicSummaryInfoResultDTO> topicSummaryInfo = topicDao.topicSummaryInfo(agencyId); |
|
|
TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); |
|
|
TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); |
|
|
|
|
|
if (topicSummaryInfo.size() != NumConstant.ZERO && shiftedCount != null) { |
|
|
Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); |
|
|
Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); |
|
|
String ratio; |
|
|
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 : ((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED + TopicConstant.RATIO; |
|
|
TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); |
|
|
TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); |
|
|
result.setName(TopicConstant.SHIFTED); |
|
|
result.setName(TopicConstant.SHIFTED); |
|
|
result.setRatio(ratio); |
|
|
result.setRatio(ratio); |
|
|
result.setValue(shiftedCount.getShiftedIssueCount()); |
|
|
result.setValue(shiftedCount.getShiftedIssueCount()); |
|
|
topicSummaryInfo.add(result); |
|
|
topicSummaryInfo.add(result); |
|
|
|
|
|
} |
|
|
return topicSummaryInfo; |
|
|
return topicSummaryInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|