diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java index 22ae365945..ad9a746ca6 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java @@ -37,10 +37,17 @@ public class ResiBuzzLeftPieChartResultDTO implements Serializable { */ private String color; + @JsonIgnore + private String issueId; + + @JsonIgnore + private Boolean status; + public ResiBuzzLeftPieChartResultDTO() { this.count = NumConstant.ZERO; this.categoryCode = ""; this.categoryName = ""; this.color = ""; + this.status = false; } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index 4fb4664534..b3b6430af1 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java @@ -254,6 +254,26 @@ public interface IssueDao extends BaseDao { */ List resiBuzzLeftPieChart(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("length")Integer length,@Param("customerId")String customerId); + /** + * @Description + * @param length + * @author zxc + * @date 2021/12/30 9:18 上午 + */ + List resiBuzzLeftPieChartByIssueIds(@Param("length")Integer length,@Param("issueIds")List issueIds); + + List resiBuzzIssueCategoryByIssueIds(@Param("length")Integer length,@Param("issueIds")List issueIds); + List resiBuzzIssueCategoryNameByIssueIds(List categories,@Param("customerId")String customerId); + + /** + * @Description 查询前50名的议题ID + * @param orgId + * @param orgType + * @author zxc + * @date 2021/12/30 9:16 上午 + */ + List resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType); + /** * @Description 查询组织下每个网格的项目数 * @param orgId @@ -270,4 +290,6 @@ public interface IssueDao extends BaseDao { */ List selectCategoryNameByIssueIds(@Param("issueIds")List issueIds); + List selectCategoryNameByIssueList(List issueIds,@Param("customerId")String customerId); + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 3ff149d81d..5a1eaaeb1c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -1605,7 +1605,22 @@ public class IssueServiceImpl extends BaseServiceImpl imp } List list = allList.stream().skip(formDTO.getPageSize() * (formDTO.getPageNo() - NumConstant.ONE)) .limit(formDTO.getPageSize()).collect(Collectors.toList()); - List names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, list.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List pieChat = getPieChat(list.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + Iterator listIterator = pieChat.iterator(); + while (listIterator.hasNext()){ + ResiBuzzLeftPieChartResultDTO next = listIterator.next(); + for (int i = 0; i < categories.size(); i++) { + if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){ + next.setStatus(true); + listIterator.remove(); + continue; + } + } + } + categories.addAll(pieChat); +// List names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + List names = baseDao.selectCategoryNameByIssueList(categories,tokenDto.getCustomerId()); if (CollectionUtils.isNotEmpty(names)){ list.forEach(l -> names.stream().filter(n -> l.getIssueId().equals(n.getIssueId())).forEach(n -> l.setCategoryName(n.getCn()))); } @@ -1651,13 +1666,43 @@ public class IssueServiceImpl extends BaseServiceImpl imp } // 分类编码长度 Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId()); - List result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); - if(CollectionUtils.isEmpty(result)){ +// List result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); + List issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType()); + if(CollectionUtils.isEmpty(issueIds)){ + return new ArrayList<>(); + } + List categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, issueIds); + List pieChat = getPieChat(issueIds); + Iterator list = pieChat.iterator(); + while (list.hasNext()){ + ResiBuzzLeftPieChartResultDTO next = list.next(); + for (int i = 0; i < categories.size(); i++) { + if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){ + next.setStatus(true); + list.remove(); + continue; + } + } + } + categories.addAll(pieChat); +// List result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds); + List result = baseDao.resiBuzzIssueCategoryNameByIssueIds(categories, tokenDto.getCustomerId()); + if (CollectionUtils.isEmpty(result)){ return new ArrayList<>(); } return result; } + public List getPieChat(List issueIds){ + List resultDTOS = new ArrayList<>(); + issueIds.forEach(i -> { + ResiBuzzLeftPieChartResultDTO dto = new ResiBuzzLeftPieChartResultDTO(); + dto.setIssueId(i); + resultDTOS.add(dto); + }); + return resultDTOS; + } + /** * @Description 查询组织下每个网格的项目数 * @param formDTO diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index ecc7dd39f0..a65070fd4a 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml @@ -621,25 +621,25 @@ @@ -676,4 +676,79 @@ ) + + + + + + + + + + + + + + + \ No newline at end of file