diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 8cdcc9c0a2..2010b316d3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -48,6 +48,10 @@ public interface NumConstant { int MAX = 99999999; int EIGHTY_EIGHT = 88; int EIGHTY = 80; + int NINETY = 90; + int ONE_HUNDRED_AND_EIGHTY = 180; + int THREE_HUNDRED_AND_SIXTY_FIVE = 365; + int SEVENTY_FIVE = 75; double ZERO_DOT_ZERO = 0.0; diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridBasicDataFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridBasicDataFormDTO.java new file mode 100644 index 0000000000..eb1b981134 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridBasicDataFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dataaggre.dto.datastats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 基础数据-网格各种数据汇总-接口入参 + * @Auth sun + */ +@Data +public class GridBasicDataFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 网格Id + */ + @NotBlank(message = "网格ID不能为空",groups = GridBasicDataFormDTO.Grid.class) + private String gridId; + /** + * 日维度Id + */ + private String dateId; + public interface Grid extends CustomerClientShowGroup{} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java index d5d3d8a66a..4789d534dd 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java @@ -38,6 +38,8 @@ public class SubAgencyFormDTO implements Serializable { public static class Topic implements Serializable { //组织Id private String agencyId; + //话题总量 + private Integer topicTotal; //话题数量 private Integer topicCount; //话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java index d429b47b7c..51e790560c 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java @@ -38,6 +38,8 @@ public class SubGridFormDTO implements Serializable { public static class Topic implements Serializable { //网格Id private String gridId; + //话题总量 + private Integer topicTotal; //话题数量 private Integer topicCount; //话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java index ad7869fd0b..d2202643c8 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java @@ -81,6 +81,8 @@ public class AgencyBasicDataResultDTO implements Serializable { @Data public static class Topic implements Serializable { + //话题总量 + private Integer topicTotal; //话题数量 private Integer topicCount; //话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridBasicDataResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridBasicDataResultDTO.java new file mode 100644 index 0000000000..1ee5dc9b8a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridBasicDataResultDTO.java @@ -0,0 +1,96 @@ +package com.epmet.dataaggre.dto.datastats.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Description 基础数据-网格各种数据汇总-接口返参 + * @Auth sun + */ +@Data +public class GridBasicDataResultDTO implements Serializable { + private static final long serialVersionUID = 466974582608407121L; + @JsonIgnore + BigDecimal bi = new BigDecimal(0); + /** + * 网格Id + */ + private String gridId; + //用户总数 + private Integer userTotal = 0; + //党员总数 + private Integer partyMemberTotal = 0; + //党员总数占比 + private BigDecimal partyMemberRatio = bi; + //居民总数 + private Integer resiTotal = 0; + //居民总数占比 + private BigDecimal resiRatio = bi; + //党群小组总数 + private Integer groupTotal = 0; + //楼院小组总数 + private Integer ordinaryTotal = 0; + //楼院小组总数占比 + private BigDecimal ordinaryRatio = bi; + //支部小组总数 + private Integer branchTotal = 0; + //支部小组总数占比 + private BigDecimal branchRatio = bi; + //话题总数 + private Integer topicTotal = 0; + //热议中总数 + private Integer discussingTotal = 0; + //热议中总数占比 + private BigDecimal discussingRatio = bi; + //已处理总数 + private Integer closedTopicTotal = 0; + //已处理总数占比 + private BigDecimal closedTopicRatio = bi; + //转议题总数 + private Integer shiftIssueTotal = 0; + //转议题总数占比 + private BigDecimal shiftIssueRatio = bi; + //议题总数 + private Integer issueTotal = 0; + //表决中总数 + private Integer votingTotal = 0; + //表决中总数占比 + private BigDecimal votingRatio = bi; + //已处理总数 + private Integer closedIssueTotal = 0; + //已处理总数占比 + private BigDecimal closedIssueRatio = bi; + //已转项目总数 + private Integer shiftProjectTotal = 0; + //已转项目总数占比 + private BigDecimal shiftProjectRatio = bi; + //项目总数 + private Integer projectTotal = 0; + //处理中总数 + private Integer pendingTotal = 0; + //处理中总数占比 + private BigDecimal pendingRatio = bi; + //已结案总数 + private Integer closedProjectTotal = 0; + //已结案总数占比 + private BigDecimal closedProjectRatio = bi; + + + @Data + public static class Topic implements Serializable { + //话题总量 + private Integer topicTotal; + //话题数量 + private Integer topicCount; + //话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing + private String topicStatus; + //话题已转议题数量 + private Integer shiftedIssueTotal; + //数据更新至 时间 + private String deadline; + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java index 951696b919..162b7e5671 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java @@ -3,6 +3,7 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; +import com.epmet.dataaggre.dto.datastats.form.GridBasicDataFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO; import com.epmet.dataaggre.dto.datastats.result.*; @@ -37,6 +38,17 @@ public class DataStatsController { return new Result().ok(dataStatsService.agencyBasicData(formDTO)); } + /** + * @Param formDTO + * @Description 网格下五项基础数据汇总 + * @author sun + */ + @PostMapping("gridbasicdata") + public Result gridBasicData(@RequestBody GridBasicDataFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridBasicDataFormDTO.Grid.class); + return new Result().ok(dataStatsService.gridBasicData(formDTO)); + } + /** * @Param formDTO * @Description 查询当前组织的直属下级组织用户数据 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java index c96b053cba..d84e733e50 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java @@ -58,6 +58,12 @@ public interface DataStatsDao { */ AgencyBasicDataResultDTO.Topic getAgencyTopicShiftIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + /** + * @Description 热议中话题-机关日统计数据 + * @author sun + */ + AgencyBasicDataResultDTO.Topic getAgencyTopicHotDiscuss(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + /** * @Description 查询组织下最新议题日统计数据 * @author sun @@ -118,6 +124,12 @@ public interface DataStatsDao { */ List getSubAgencyTopicShiftIssue(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + /** + * @Description 查询直属下级组织热议中话题-机关日统计数据 + * @author sun + */ + List getSubAgencyTopicHotDiscuss(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + /** * @Description 查询网格层级状态话题-日统计数据 * @author sun @@ -130,6 +142,12 @@ public interface DataStatsDao { */ List getSubGridTopicShiftIssue(@Param("gridIds") List gridIds, @Param("dateId") String dateId); + /** + * @Description 查询网格层级热议中话题-日统计数据 + * @author sun + */ + List getSubGridTopicHotDiscuss(@Param("gridIds") List gridIds, @Param("dateId") String dateId); + /** * @Description 查询直属下级组织议题日统计数据,默认按议题总数降序 * @author sun diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index 6eb826dc8d..256aaeb15c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -1,6 +1,7 @@ package com.epmet.dataaggre.service.datastats; import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; +import com.epmet.dataaggre.dto.datastats.form.GridBasicDataFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO; import com.epmet.dataaggre.dto.datastats.result.*; @@ -20,6 +21,13 @@ public interface DataStatsService { */ AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO); + /** + * @Param formDTO + * @Description 网格下五项基础数据汇总 + * @author sun + */ + GridBasicDataResultDTO gridBasicData(GridBasicDataFormDTO formDTO); + /** * @Param formDTO * @Description 查询当前组织的直属下级组织用户数据 @@ -91,4 +99,5 @@ public interface DataStatsService { * @author sun */ List subGridProject(SubGridFormDTO formDTO); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index 900144795e..f8ddfde557 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; +import com.epmet.dataaggre.dto.datastats.form.GridBasicDataFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO; import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO; import com.epmet.dataaggre.dto.datastats.result.*; @@ -47,7 +48,7 @@ public class DataStatsServiceImpl implements DataStatsService { AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO(); resultDTO.setAgencyId(formDTO.getAgencyId()); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -78,29 +79,32 @@ public class DataStatsServiceImpl implements DataStatsService { //3.查询组织下最新话题日统计数据 //状态话题-机关日统计数据表最新日期三种状态数据 - //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数 + //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 List topic = dataStatsDao.getAgencyTopic(formDTO.getAgencyId(), formDTO.getDateId()); //转议题话题-机关日统计数据表 AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId()); + //热议中话题-机关日统计数据 + AgencyBasicDataResultDTO.Topic hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(formDTO.getAgencyId(), formDTO.getDateId()); AtomicReference closedTotal = new AtomicReference<>(0); - AtomicReference hiddenTotal = new AtomicReference<>(0); if (topic.size() > NumConstant.ZERO) { resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); topic.forEach(t -> { if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); } - if (t.getTopicStatus().equals("hidden")) { - hiddenTotal.set(t.getTopicCount()); - } }); } + //转议题 if (null != topicSHiftIssue) { resultDTO.setShiftIssueTotal(topicSHiftIssue.getShiftedIssueTotal()); resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); } - resultDTO.setDiscussingTotal(resultDTO.getTopicTotal() - closedTotal.get() - hiddenTotal.get() - resultDTO.getShiftIssueTotal()); - resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); + //热议中 + if (null != hotdiscuss) { + resultDTO.setDiscussingTotal(hotdiscuss.getTopicCount()); + resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); + } + //已处理 resultDTO.setClosedTopicTotal(closedTotal.get()); resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); @@ -129,6 +133,103 @@ public class DataStatsServiceImpl implements DataStatsService { return resultDTO; } + /** + * @Param formDTO + * @Description 网格下五项基础数据汇总 + * @author sun + */ + @Override + public GridBasicDataResultDTO gridBasicData(GridBasicDataFormDTO formDTO) { + GridBasicDataResultDTO resultDTO = new GridBasicDataResultDTO(); + resultDTO.setGridId(formDTO.getGridId()); + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); + + //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 + if (StringUtils.isBlank(formDTO.getDateId())) { + Date yesterday = DateUtils.addDateDays(new Date(), -1); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); + formDTO.setDateId(format.format(yesterday)); + } + + //1.查询网格下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】 + List gridIds = new ArrayList<>(); + gridIds.add(formDTO.getGridId()); + List userList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); + if (userList.size() > NumConstant.ZERO) { + resultDTO.setUserTotal(userList.get(0).getUserTotal()); + resultDTO.setResiTotal(userList.get(0).getResiTotal()); + resultDTO.setResiRatio(resultDTO.getResiTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getResiTotal() / (float) resultDTO.getUserTotal()))); + resultDTO.setPartyMemberTotal(userList.get(0).getPartyMemberTotal()); + resultDTO.setPartyMemberRatio(resultDTO.getPartyMemberTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPartyMemberTotal() / (float) resultDTO.getUserTotal()))); + } + + //2.查询网格下最新群组日统计数据 + List groupList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); + if (groupList.size() > NumConstant.ZERO) { + resultDTO.setGroupTotal(groupList.get(0).getGroupTotal()); + resultDTO.setOrdinaryTotal(groupList.get(0).getOrdinaryTotal()); + resultDTO.setOrdinaryRatio(resultDTO.getOrdinaryTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getOrdinaryTotal() / (float) resultDTO.getGroupTotal()))); + resultDTO.setBranchTotal(groupList.get(0).getBranchTotal()); + resultDTO.setBranchRatio(resultDTO.getBranchTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getBranchTotal() / (float) resultDTO.getGroupTotal()))); + } + + //3.查询网格下最新话题日统计数据 + //状态话题-网格日统计数据表最新日期三种状态数据 + //网格日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 + List topicList = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId()); + //转议题话题-网格日统计数据表 + List topicShiftIssueList = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); + //热议中话题-网格日统计数据 + List hotdiscussList = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); + AtomicReference closedTotal = new AtomicReference<>(0); + if (topicList.size() > NumConstant.ZERO) { + resultDTO.setTopicTotal(topicList.stream().collect(Collectors.summingInt(SubGridFormDTO.Topic::getTopicCount))); + topicList.forEach(t -> { + if (t.getTopicStatus().equals("closed")) { + closedTotal.set(t.getTopicCount()); + } + }); + } + //转议题 + if (topicShiftIssueList.size() > NumConstant.ZERO) { + resultDTO.setShiftIssueTotal(topicShiftIssueList.get(0).getShiftedIssueTotal()); + resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); + } + //热议中 + if (hotdiscussList.size() > NumConstant.ZERO) { + resultDTO.setDiscussingTotal(hotdiscussList.get(0).getTopicCount()); + resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); + } + //已处理 + resultDTO.setClosedTopicTotal(closedTotal.get()); + resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); + + //4.查询网格下最新议题日统计数据 + List issueList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); + if (issueList.size() > NumConstant.ZERO) { + resultDTO.setIssueTotal(issueList.get(0).getIssueTotal()); + resultDTO.setVotingTotal(issueList.get(0).getVotingTotal()); + resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); + resultDTO.setClosedIssueTotal(issueList.get(0).getClosedIssueTotal()); + resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); + resultDTO.setShiftProjectTotal(issueList.get(0).getShiftProjectTotal()); + resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); + } + + //5.查询网格下最新项目日统计数据 + List projectList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); + if (projectList.size() > NumConstant.ZERO) { + resultDTO.setProjectTotal(projectList.get(0).getProjectTotal()); + resultDTO.setPendingTotal(projectList.get(0).getPendingTotal()); + resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); + resultDTO.setClosedProjectTotal(projectList.get(0).getClosedProjectTotal()); + resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); + } + + return resultDTO; + } + /** * @Param formDTO * @Description 查询当前组织的直属下级组织用户数据 @@ -138,7 +239,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subAgencyUser(SubAgencyFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -201,7 +302,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subGridUser(SubGridFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -262,7 +363,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subAgencyGroup(SubAgencyFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -322,7 +423,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subGridGroup(SubGridFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -383,7 +484,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subAgencyTopic(SubAgencyFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -404,16 +505,18 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织状态话题-日统计数据 - //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数 + //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 List topic = dataStatsDao.getSubAgencyTopic(agencyIds, formDTO.getDateId()); //查询直属下级组织转议题话题-日统计数据表 List topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); + //查询直属下级组织热议中话题-机关日统计数据 + List hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId()); agencyIds.forEach(agencyId -> { SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0); - AtomicInteger hiddenTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0); + AtomicInteger hotdiscussTotal = new AtomicInteger(0); AtomicReference agencyName = new AtomicReference<>(""); topic.forEach(t -> { if (t.getAgencyId().equals(agencyId)) { @@ -421,9 +524,6 @@ public class DataStatsServiceImpl implements DataStatsService { if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); } - if (t.getTopicStatus().equals("hidden")) { - hiddenTotal.set(t.getTopicCount()); - } } }); topicShiftIssue.forEach(t -> { @@ -431,6 +531,11 @@ public class DataStatsServiceImpl implements DataStatsService { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); + hotdiscuss.forEach(t -> { + if (t.getAgencyId().equals(agencyId)) { + hotdiscussTotal.addAndGet(t.getTopicCount()); + } + }); subAgencyList.forEach(sub -> { if (agencyId.equals(sub.getId())) { agencyName.set(sub.getAgencyName()); @@ -440,7 +545,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setAgencyId(agencyId); resultDTO.setAgencyName(agencyName.get()); resultDTO.setTopicTotal(topicTotal.get()); - resultDTO.setDiscussingTotal(topicTotal.get() - closedTotal.get() - hiddenTotal.get() - shiftIssueTotal.get()); + resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); resultDTO.setClosedTopicTotal(closedTotal.get()); resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); @@ -479,7 +584,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subGridTopic(SubGridFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -504,12 +609,14 @@ public class DataStatsServiceImpl implements DataStatsService { List topic = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId()); //查询网格层级转议题话题-日统计数据表 List topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); + //查询网格层级热议中话题-日统计数据 + List hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); gridIds.forEach(gridId -> { SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0); - AtomicInteger hiddenTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0); + AtomicInteger hotdiscussTotal = new AtomicInteger(0); AtomicReference gridName = new AtomicReference<>(""); topic.forEach(t -> { if (t.getGridId().equals(gridId)) { @@ -517,9 +624,6 @@ public class DataStatsServiceImpl implements DataStatsService { if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); } - if (t.getTopicStatus().equals("hidden")) { - hiddenTotal.set(t.getTopicCount()); - } } }); topicShiftIssue.forEach(t -> { @@ -527,6 +631,11 @@ public class DataStatsServiceImpl implements DataStatsService { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); + hotdiscuss.forEach(t -> { + if (t.getGridId().equals(gridId)) { + hotdiscussTotal.addAndGet(t.getTopicCount()); + } + }); gridList.forEach(sub -> { if (gridId.equals(sub.getId())) { gridName.set(sub.getGridName()); @@ -536,7 +645,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setGridId(gridId); resultDTO.setGridName(gridName.get()); resultDTO.setTopicTotal(topicTotal.get()); - resultDTO.setDiscussingTotal(topicTotal.get() - closedTotal.get() - hiddenTotal.get() - shiftIssueTotal.get()); + resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); resultDTO.setClosedTopicTotal(closedTotal.get()); resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); @@ -574,7 +683,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subAgencyIssue(SubAgencyFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -637,7 +746,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subGridIssue(SubGridFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -700,7 +809,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subAgencyProject(SubAgencyFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { @@ -760,7 +869,7 @@ public class DataStatsServiceImpl implements DataStatsService { public List subGridProject(SubGridFormDTO formDTO) { List resultList = new ArrayList<>(); NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.FOUR); + numberFormat.setMaximumFractionDigits(NumConstant.THREE); //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 if (StringUtils.isBlank(formDTO.getDateId())) { diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml index 06967cceab..4096010837 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml @@ -58,6 +58,19 @@ LIMIT 1 + + + + + + + + + UPDATE issue_project_category_dict SET diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MassesDiscontentFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MassesDiscontentFormDTO.java new file mode 100644 index 0000000000..5a2e934a99 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MassesDiscontentFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/5/13 5:16 下午 + * @DESC + */ +@Data +public class MassesDiscontentFormDTO implements Serializable { + + private static final long serialVersionUID = -9104774532905137856L; + + public interface MassesDiscontentForm{} + + /** + * 时间区间,三个月:threeMonth;半年:sixMonth;一年:twelveMonth + * 一个月按照30天,三个月90天,半年180天,一年365天 + */ + private String timeSection; + + /** + * asc:分数由低到高 + * desc:分数由高到低 + */ + private String sortType; + + /** + * 组织ID + */ + private String agencyId; + + @NotNull(message = "pageNo不能为空",groups = MassesDiscontentForm.class) + private Integer pageNo; + + @NotNull(message = "pageSize不能为空",groups = MassesDiscontentForm.class) + private Integer pageSize; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MassesDiscontentResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MassesDiscontentResultDTO.java new file mode 100644 index 0000000000..905dd0be8d --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MassesDiscontentResultDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/5/14 9:04 上午 + * @DESC + */ +@Data +public class MassesDiscontentResultDTO implements Serializable { + + private static final long serialVersionUID = 8954504790464516198L; + + /** + * 项目ID + */ + private String projectId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 话题所在网格 + */ + private String gridName; + + /** + * 话题图片 + */ + private List photos; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 项目分类标签 + */ + private String projectCategory; + + /** + * 项目评价分数 + */ + @JsonIgnore + private Integer score; + + public MassesDiscontentResultDTO() { + this.gridName = ""; + this.photos = new ArrayList<>(); + this.topicContent = ""; + this.projectCategory = ""; + } +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectScoreResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectScoreResultDTO.java new file mode 100644 index 0000000000..9b2127224b --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectScoreResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/5/18 1:29 下午 + * @DESC + */ +@Data +public class ProjectScoreResultDTO implements Serializable { + + private static final long serialVersionUID = 8559486245200043097L; + + /** + * 项目ID + */ + private String projectId; + + /** + * 项目评价分数 + */ + private Integer score; + + /** + * 议题ID + */ + private String issueId; +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index c32d227ad6..84124b0c69 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -178,4 +178,18 @@ public interface ProjectConstant { String EVALUATE_GOOD = "good"; String EVALUATE_BAD = "bad"; String EVALUATE_PERFECT = "perfect"; + + /** + * 三个月,六个月,12个月 + */ + String THREE_MONTH = "threeMonth"; + String SIX_MONTH = "sixMonth"; + String TWELVE_MONTH = "twelveMonth"; + + /** + * 排序 + */ + String SORT_ASC = "asc"; + String SORT_DESC = "desc"; + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionStatisticsController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionStatisticsController.java index 78fed6b459..62fbe24a59 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionStatisticsController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionStatisticsController.java @@ -26,7 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.ProjectSatisfactionStatisticsDTO; +import com.epmet.dto.form.MassesDiscontentFormDTO; import com.epmet.dto.form.ProjectEvaluateScoreFormDTO; +import com.epmet.dto.result.MassesDiscontentResultDTO; import com.epmet.dto.result.ProjectEvaluateScoreResultDTO; import com.epmet.excel.ProjectSatisfactionStatisticsExcel; import com.epmet.service.ProjectSatisfactionStatisticsService; @@ -105,4 +107,16 @@ public class ProjectSatisfactionStatisticsController { return new Result().ok(projectSatisfactionStatisticsService.projectEvaluateScore(formDTO)); } + /** + * @Description 群众不满 + * @Param formDTO + * @author zxc + * @date 2021/5/14 10:46 上午 + */ + @PostMapping("massesdiscontent") + public Result> massesDiscontent(@RequestBody MassesDiscontentFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MassesDiscontentFormDTO.MassesDiscontentForm.class); + return new Result>().ok(projectSatisfactionStatisticsService.massesDiscontent(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java index 247f239261..cc2d336344 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.result.ProjectCategoryDisPoseResultDTO; import com.epmet.entity.ProjectCategoryEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -52,4 +53,12 @@ public interface ProjectCategoryDao extends BaseDao { * @Author sun **/ List selectProjectCategoryList(DelCategoryFormDTO formDTO); + + /** + * @Description 根据项目ID查询项目分类 + * @Param projectIds + * @author zxc + * @date 2021/5/17 10:47 上午 + */ + List selectCategoryByIds(@Param("projectIds")List projectIds); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index 17efc1b958..2c2fe53f31 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -154,4 +154,14 @@ public interface ProjectDao extends BaseDao { * @date 2021/5/12 10:29 上午 */ List selectAllClosedProject(); + + /** + * @Description 查询时间段内的项目ID + * @Param agencyId + * @Param startDate + * @Param endDate + * @author zxc + * @date 2021/5/14 1:59 下午 + */ + List selectProjectIdByTime(@Param("agencyId")String agencyId,@Param("endDate")Integer endDate,@Param("startDate")Integer startDate); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java index 3eb3dcb601..89e4d5049e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.MassesDiscontentResultDTO; +import com.epmet.dto.result.ProjectScoreResultDTO; import com.epmet.entity.ProjectSatisfactionStatisticsEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -66,4 +68,12 @@ public interface ProjectSatisfactionStatisticsDao extends BaseDao selectProjectByScore(@Param("projectIds")List projectIds, @Param("setScore")Integer setScore, @Param("sortType")String sortType); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionStatisticsService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionStatisticsService.java index fa035d53f6..24b4f24b5b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionStatisticsService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionStatisticsService.java @@ -20,7 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.ProjectSatisfactionStatisticsDTO; +import com.epmet.dto.form.MassesDiscontentFormDTO; import com.epmet.dto.form.ProjectEvaluateScoreFormDTO; +import com.epmet.dto.result.MassesDiscontentResultDTO; import com.epmet.dto.result.ProjectEvaluateScoreResultDTO; import com.epmet.entity.ProjectSatisfactionStatisticsEntity; @@ -102,4 +104,12 @@ public interface ProjectSatisfactionStatisticsService extends BaseService massesDiscontent(MassesDiscontentFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java index 222a96644a..ed20dfd167 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java @@ -21,24 +21,42 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ProjectConstant; +import com.epmet.dao.ProjectCategoryDao; +import com.epmet.dao.ProjectDao; import com.epmet.dao.ProjectSatisfactionStatisticsDao; import com.epmet.dto.ProjectSatisfactionStatisticsDTO; +import com.epmet.dto.form.MassesDiscontentFormDTO; import com.epmet.dto.form.ProjectEvaluateScoreFormDTO; +import com.epmet.dto.result.MassesDiscontentResultDTO; +import com.epmet.dto.result.ProjectCategoryDisPoseResultDTO; import com.epmet.dto.result.ProjectEvaluateScoreResultDTO; +import com.epmet.dto.result.ProjectScoreResultDTO; import com.epmet.entity.ProjectSatisfactionStatisticsEntity; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.redis.ProjectSatisfactionStatisticsRedis; +import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.ProjectSatisfactionStatisticsService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目满意度调查统计表 @@ -51,6 +69,14 @@ public class ProjectSatisfactionStatisticsServiceImpl extends BaseServiceImpl page(Map params) { @@ -125,4 +151,80 @@ public class ProjectSatisfactionStatisticsServiceImpl extends BaseServiceImpl massesDiscontent(MassesDiscontentFormDTO formDTO) { + List projectIds = projectDao.selectProjectIdByTime(formDTO.getAgencyId(), getDateId("yesterday"), getDateId(formDTO.getTimeSection())); + if (CollectionUtils.isEmpty(projectIds)){ + return new ArrayList<>(); + } + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectProjectByScore(projectIds.stream().map(m -> m.getProjectId()).collect(Collectors.toList()), NumConstant.SEVENTY_FIVE, formDTO.getSortType())); + List projects = pageInfo.getList(); + if (CollectionUtils.isEmpty(projects)){ + return new ArrayList<>(); + } + List projectCategoryDisPoseResultDTOS = projectCategoryDao.selectCategoryByIds(projects.stream().map(m -> m.getProjectId()).collect(Collectors.toList())); + List projectCategoryData = new ArrayList<>(); + if (!CollectionUtils.isEmpty(projectCategoryDisPoseResultDTOS)){ + Result> projectCategory = issueOpenFeignClient.getProjectCategory(projectCategoryDisPoseResultDTOS); + if (!projectCategory.success()){ + throw new RenException("查询项目分类标签失败".concat(projectCategory.getMsg())); + } + projectCategoryData = projectCategory.getData(); + } + Result> topicInfos = resiGroupOpenFeignClient.getTopicInfos(projects.stream().map(m -> m.getIssueId()).collect(Collectors.toList())); + if (!topicInfos.success()){ + throw new RenException("查询话题信息失败".concat(topicInfos.getMsg())); + } + List finalProjectCategoryData = projectCategoryData; + projects.forEach(p -> { + if (!CollectionUtils.isEmpty(finalProjectCategoryData)){ + finalProjectCategoryData.forEach(cate -> { + if (p.getProjectId().equals(cate.getProjectId())){ + p.setProjectCategory(cate.getProjectCategory()); + } + }); + } + if (!CollectionUtils.isEmpty(topicInfos.getData())){ + topicInfos.getData().forEach(t -> { + if (p.getIssueId().equals(t.getIssueId())){ + p.setGridName(t.getGridName()); + p.setTopicContent(t.getTopicContent()); + p.setPhotos(t.getPhotos()); + } + }); + } + }); + return projects; + } + + /** + * @Description 处理时间 + * @Param dateType + * @author zxc + * @date 2021/5/18 2:28 下午 + */ + public Integer getDateId(String dateType){ + String beforeNDay = DateUtils.getBeforeNDay(NumConstant.ONE); + Integer result = Integer.valueOf(beforeNDay); + switch (dateType) { + case ProjectConstant.THREE_MONTH: + result = Integer.valueOf(DateUtils.getBeforeNDay(NumConstant.NINETY)); + break; + case ProjectConstant.SIX_MONTH: + result = Integer.valueOf(DateUtils.getBeforeNDay(NumConstant.ONE_HUNDRED_AND_EIGHTY)); + break; + case ProjectConstant.TWELVE_MONTH: + result = Integer.valueOf(DateUtils.getBeforeNDay(NumConstant.THREE_HUNDRED_AND_SIXTY_FIVE)); + break; + default: + } + return result; + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml index 30033c620e..3f9c27f6d2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml @@ -35,4 +35,19 @@ project_id = #{projectId} + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index 879dc9904a..b611bedcad 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -281,4 +281,18 @@ AND ORIGIN = 'issue' AND `STATUS` = 'closed' + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml index 583b77f8be..0b4a51c479 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml @@ -41,5 +41,29 @@ select * from project_satisfaction_statistics where DEL_FLAG = '0' AND PROJECT_ID = #{projectId} + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicInfoResultDTO.java new file mode 100644 index 0000000000..4a2d43ea8e --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicInfoResultDTO.java @@ -0,0 +1,42 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/5/17 2:44 下午 + * @DESC + */ +@Data +public class TopicInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 4068679301595597877L; + + /** + * 议题ID + */ + private String issueId; + + /** + * 话题所在网格 + */ + private String gridName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 话题图片 + */ + private List photos; + + /** + * 话题内容 + */ + private String topicContent; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index 1e5e099201..781310e6ed 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -10,6 +10,7 @@ import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.*; +import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import org.springframework.cloud.openfeign.FeignClient; @@ -269,4 +270,14 @@ public interface ResiGroupOpenFeignClient { */ @PostMapping("/resi/group/topic/allmessages") Result> allMessages(@RequestBody AllMessagesFormDTO formDTO); + + /** + * @Description 查询话题信息 + * @Param issueIds + * @author zxc + * @date 2021/5/17 4:19 下午 + */ + @PostMapping("resi/group/topic/gettopicinfos") + Result> getTopicInfos(@RequestBody List issueIds); + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index dd0b1de61c..c53face2ea 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -21,6 +21,7 @@ import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO; import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO; import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import org.springframework.stereotype.Component; @@ -220,4 +221,9 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result> topicCreatedUserBatch(List topicIds) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicCreatedUserBatch", topicIds); } + + @Override + public Result> getTopicInfos(List issueIds) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getTopicInfos", issueIds); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index cce7de9dc5..918b1efce8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -508,4 +508,15 @@ public class ResiTopicController { return new Result>().ok(topicService.topicCreatedUserBatch(topicIds)); } + + /** + * @Description 查询话题信息 + * @Param issueIds + * @author zxc + * @date 2021/5/17 4:19 下午 + */ + @PostMapping("gettopicinfos") + public Result> getTopicInfos(@RequestBody List issueIds){ + return new Result>().ok(topicService.getTopicInfos(issueIds)); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java index abc817659d..88bc4abad0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java @@ -224,4 +224,12 @@ public interface ResiTopicDao extends BaseDao { * @author sun */ int upTopicList(@Param("delIdList") List delIdList, @Param("userId") String userId); + + /** + * @Description 查询话题信息 + * @Param issueIds + * @author zxc + * @date 2021/5/17 4:54 下午 + */ + List getTopicInfos(@Param("issueIds") List issueIds); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java index 45189029db..6057a78f06 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java @@ -407,4 +407,12 @@ public interface ResiTopicService extends BaseService { * @date 2021/5/12 9:16 上午 */ List topicCreatedUserBatch(List topicIds); + + /** + * @Description 查询话题信息 + * @Param issueIds + * @author zxc + * @date 2021/5/17 4:19 下午 + */ + List getTopicInfos(List issueIds); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 2cec84d4d9..e6ce2039c7 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -103,6 +103,7 @@ import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.CheckTopicPublisherResultDTO; import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO; import com.epmet.resi.group.dto.topic.result.*; +import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; import com.epmet.send.SendMqMsgUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -2793,6 +2794,32 @@ public class ResiTopicServiceImpl extends BaseServiceImpl getTopicInfos(List issueIds) { + if (CollectionUtils.isEmpty(issueIds)){ + return new ArrayList<>(); + } + List topicInfos = baseDao.getTopicInfos(issueIds); + Result> gridNames = govOrgOpenFeignClient.getGridListByGridIds(topicInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList())); + if (!gridNames.success()){ + throw new RenException("查询网格Name失败"); + } + topicInfos.forEach(t -> { + gridNames.getData().forEach(g -> { + if (t.getGridId().equals(g.getGridId())){ + t.setGridName(g.getGridName()); + } + }); + }); + return topicInfos; + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml index b5f35a8a7a..d912ca952b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml @@ -606,5 +606,30 @@ + + + + + + + + + +