diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 5a36af7c15..76cfc7865d 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.130:3306/epmet_third?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epmet_dba password: EpmEt-dbA-UsEr #oracle配置 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java new file mode 100644 index 0000000000..ad33559d5b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java @@ -0,0 +1,38 @@ +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 AgencyGovrnFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = AgencyGovrnFormDTO.Agency.class) + private String agencyId; + /** + * 日维度Id + */ + private String dateId; + /** + * 排序类型字段 + * 问题解决总数:problem + * 党群自治占比:party + * 网格自治占比:grid + * 社区解决占比:community + * 区直部门解决占比:dept + * 街道解决占比:street + */ + private String type; + public interface Agency extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridGovrnFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridGovrnFormDTO.java new file mode 100644 index 0000000000..45eaa572c5 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridGovrnFormDTO.java @@ -0,0 +1,41 @@ +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 GridGovrnFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 组织Id + */ + @NotBlank(message = "机关Id不能为空",groups = GridGovrnFormDTO.Agency.class) + private String agencyId; + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空",groups = GridGovrnFormDTO.Grid.class) + private String gridId; + /** + * 日维度Id + */ + private String dateId; + /** + * 排序类型字段 + * 问题解决总数:problem + * 党群自治占比:party + * 网格自治占比:grid + */ + private String type; + public interface Agency extends CustomerClientShowGroup {} + public interface Grid extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyGovrnResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyGovrnResultDTO.java new file mode 100644 index 0000000000..b15017ea33 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyGovrnResultDTO.java @@ -0,0 +1,37 @@ +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 AgencyGovrnResultDTO implements Serializable { + private static final long serialVersionUID = 466974582608407121L; + @JsonIgnore + BigDecimal bi = new BigDecimal(0); + //组织Id + private String agencyId; + //组织名称 + private String agencyName = ""; + //agency_id所属的机关级别(社区级:community,乡(镇、街道)级:street, 区县级: district, 市级: city, 省级:province) + private String level = ""; + //问题解决总数 + private Integer problemResolvedCount = 0; + //党群自治占比 + private BigDecimal groupSelfGovernRatio = bi; + //网格自治占比 + private BigDecimal gridSelfGovernRatio = bi; + //社区解决占比 + private BigDecimal communityResolvedRatio = bi; + //区直部门解决占比 + private BigDecimal districtDeptResolvedRatio = bi; + //街道解决占比 + private BigDecimal streetResolvedRatio = bi; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridGovrnResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridGovrnResultDTO.java new file mode 100644 index 0000000000..9b16f7b014 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GridGovrnResultDTO.java @@ -0,0 +1,29 @@ +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 GridGovrnResultDTO implements Serializable { + private static final long serialVersionUID = 466974582608407121L; + @JsonIgnore + BigDecimal bi = new BigDecimal(0); + //网格Id + private String gridId; + //网格名称 + private String gridName = ""; + //问题解决总数 + private Integer problemResolvedCount = 0; + //党群自治占比 + private BigDecimal groupSelfGovernRatio = bi; + //网格自治占比 + private BigDecimal gridSelfGovernRatio = bi; + +} 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 162b7e5671..74b2552e43 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 @@ -2,10 +2,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.form.*; import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.service.datastats.DataStatsService; import org.springframework.beans.factory.annotation.Autowired; @@ -159,4 +156,48 @@ public class DataStatsController { return new Result>().ok(dataStatsService.subGridProject(formDTO)); } + /** + * @Param formDTO + * @Description 治理实况-当前组织治理指数 + * @author sun + */ + @PostMapping("agencygovrn") + public Result agencyGovrn(@RequestBody AgencyGovrnFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyGovrnFormDTO.Agency.class); + return new Result().ok(dataStatsService.agencyGovrn(formDTO)); + } + + /** + * @Param formDTO + * @Description 治理实况-组织直属下级治理指数列表 + * @author sun + */ + @PostMapping("subagencygovrnlist") + public Result> subAgencyGovrnList(@RequestBody AgencyGovrnFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyGovrnFormDTO.Agency.class); + return new Result>().ok(dataStatsService.subAgencyGovrnList(formDTO)); + } + + /** + * @Param formDTO + * @Description 治理实况-当前网格治理指数 + * @author sun + */ + @PostMapping("gridgovrn") + public Result gridGovrn(@RequestBody GridGovrnFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridGovrnFormDTO.Grid.class); + return new Result().ok(dataStatsService.gridGovrn(formDTO)); + } + + /** + * @Param formDTO + * @Description 治理实况-组织直属网格治理指数列表 + * @author sun + */ + @PostMapping("subgridgovrnlist") + public Result> subGridGovrnList(@RequestBody GridGovrnFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridGovrnFormDTO.Agency.class); + return new Result>().ok(dataStatsService.subGridGovrnList(formDTO)); + } + } 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 02d6e72a76..b49b16fc0c 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 @@ -228,4 +228,18 @@ public interface DataStatsDao { @Param("actCategoryDictDTOList") List actCategoryDictDTOList); DimAgencyEntity getAgencyInfo(@Param("agencyId") String agencyId); + + /** + * @Param formDTO + * @Description 根据组织Id查询事件治理指数 + * @author sun + */ + List getAgencyGovern(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + + /** + * @Param formDTO + * @Description 根据网格Id查询事件治理指数 + * @author sun + */ + List getGridGovern(@Param("gridIds") List gridIds, @Param("dateId") String dateId); } \ No newline at end of file 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 1e99251989..472bc277b4 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,11 +1,7 @@ package com.epmet.dataaggre.service.datastats; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; -import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; -import com.epmet.dataaggre.dto.datastats.form.PartyMemberVanguardFormDTO; -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.form.*; import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; @@ -128,4 +124,32 @@ public interface DataStatsService { List querySubAnalysisByCode(String customerId, String pid, String dateId, String categoryCode); List selectGroupActRankDetail(String customerId, String dateId, String orgId, List actCategoryDictDTOList); + + /** + * @Param formDTO + * @Description 治理实况-当前组织治理指数 + * @author sun + */ + AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO); + + /** + * @Param formDTO + * @Description 治理实况-组织直属下级治理指数列表 + * @author sun + */ + List subAgencyGovrnList(AgencyGovrnFormDTO formDTO); + + /** + * @Param formDTO + * @Description 治理实况-当前网格治理指数 + * @author sun + */ + GridGovrnResultDTO gridGovrn(GridGovrnFormDTO formDTO); + + /** + * @Param formDTO + * @Description 治理实况-组织直属网格治理指数列表 + * @author sun + */ + List subGridGovrnList(GridGovrnFormDTO 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 9daf0c36ab..59bca42a8a 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 @@ -7,11 +7,7 @@ import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; -import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; -import com.epmet.dataaggre.dto.datastats.form.PartyMemberVanguardFormDTO; -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.form.*; import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; @@ -267,18 +263,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序 - resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); - re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyUserResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setUserTotal(u.getUserTotal()); + dto.setPartyMemberTotal(u.getPartyMemberTotal()); + dto.setResiTotal(u.getResiTotal()); } - }); - }); + } + dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); + dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -330,18 +332,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级注册用户日统计数据,默认按用户总数降序 - resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); - re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridUserResultDTO dto = new SubGridUserResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridUserResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setUserTotal(re.getUserTotal()); + dto.setPartyMemberTotal(re.getPartyMemberTotal()); + dto.setResiTotal(re.getResiTotal()); } - }); - }); + } + dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); + dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -391,18 +399,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织小组日统计数据,默认按群组总数降序 - resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); - re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyGroupResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setGroupTotal(u.getGroupTotal()); + dto.setOrdinaryTotal(u.getOrdinaryTotal()); + dto.setBranchTotal(u.getBranchTotal()); } - }); - }); + } + dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); + dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -451,18 +465,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级小组日统计数据,默认按群组总数降序 - resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); //3.封装数据并返回 - resultList.forEach(re -> { - re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); - re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridGroupResultDTO dto = new SubGridGroupResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridGroupResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setGroupTotal(re.getGroupTotal()); + dto.setOrdinaryTotal(re.getOrdinaryTotal()); + dto.setBranchTotal(re.getBranchTotal()); } - }); - }); + } + dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); + dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -518,15 +538,14 @@ public class DataStatsServiceImpl implements DataStatsService { List topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); //查询直属下级组织热议中话题-机关日统计数据 List hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId()); - agencyIds.forEach(agencyId -> { + subAgencyList.forEach(sub -> { SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = 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)) { + if (t.getAgencyId().equals(sub.getId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -534,23 +553,18 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getAgencyId().equals(agencyId)) { + if (t.getAgencyId().equals(sub.getId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getAgencyId().equals(agencyId)) { + if (t.getAgencyId().equals(sub.getId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - subAgencyList.forEach(sub -> { - if (agencyId.equals(sub.getId())) { - agencyName.set(sub.getAgencyName()); - } - }); - resultDTO.setAgencyId(agencyId); - resultDTO.setAgencyName(agencyName.get()); + resultDTO.setAgencyId(sub.getId()); + resultDTO.setAgencyName(sub.getAgencyName()); resultDTO.setTopicTotal(topicTotal.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()))); @@ -618,15 +632,14 @@ public class DataStatsServiceImpl implements DataStatsService { List topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); //查询网格层级热议中话题-日统计数据 List hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); - gridIds.forEach(gridId -> { + gridList.forEach(gr -> { SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger closedTotal = 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)) { + if (t.getGridId().equals(gr.getId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -634,23 +647,18 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getGridId().equals(gridId)) { + if (t.getGridId().equals(gr.getId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getGridId().equals(gridId)) { + if (t.getGridId().equals(gr.getId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - gridList.forEach(sub -> { - if (gridId.equals(sub.getId())) { - gridName.set(sub.getGridName()); - } - }); - resultDTO.setGridId(gridId); - resultDTO.setGridName(gridName.get()); + resultDTO.setGridId(gr.getId()); + resultDTO.setGridName(gr.getGridName()); resultDTO.setTopicTotal(topicTotal.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()))); @@ -711,19 +719,26 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织议题日统计数据,默认按议题总数降序 - resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); - re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); - re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyIssueResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setIssueTotal(u.getIssueTotal()); + dto.setVotingTotal(u.getVotingTotal()); + dto.setClosedIssueTotal(u.getClosedIssueTotal()); + dto.setShiftProjectTotal(u.getShiftProjectTotal()); } - }); - }); + } + dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); + dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); + dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -774,19 +789,26 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级议题日统计数据,默认按议题总数降序 - resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); - re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); - re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridIssueResultDTO dto = new SubGridIssueResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridIssueResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setIssueTotal(re.getIssueTotal()); + dto.setVotingTotal(re.getVotingTotal()); + dto.setClosedIssueTotal(re.getClosedIssueTotal()); + dto.setShiftProjectTotal(re.getShiftProjectTotal()); } - }); - }); + } + dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); + dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); + dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -837,18 +859,24 @@ public class DataStatsServiceImpl implements DataStatsService { List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); //2.查询直属下级组织项目日统计数据,默认按项目总数降序 - resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); + List list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); - re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); - subAgencyList.forEach(sub -> { - if (re.getAgencyId().equals(sub.getId())) { - re.setAgencyName(sub.getAgencyName()); + for (DimAgencyEntity sub : subAgencyList) { + SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + for (SubAgencyProjectResultDTO u : list) { + if (sub.getId().equals(u.getAgencyId())) { + dto.setProjectTotal(u.getProjectTotal()); + dto.setPendingTotal(u.getPendingTotal()); + dto.setClosedProjectTotal(u.getClosedProjectTotal()); } - }); - }); + } + dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); + dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -897,18 +925,24 @@ public class DataStatsServiceImpl implements DataStatsService { List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); //2.查询网格层级项目日统计数据,默认按项目总数降序 - resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); + List list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); //3.封装数据 - resultList.forEach(re -> { - re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); - re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); - gridList.forEach(sub -> { - if (re.getGridId().equals(sub.getId())) { - re.setGridName(sub.getGridName()); + for (DimGridEntity gr : gridList) { + SubGridProjectResultDTO dto = new SubGridProjectResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (SubGridProjectResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setProjectTotal(re.getProjectTotal()); + dto.setPendingTotal(re.getPendingTotal()); + dto.setClosedProjectTotal(re.getClosedProjectTotal()); } - }); - }); + } + dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); + dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); + resultList.add(dto); + } //4.按要求排序并返回 Collections.sort(resultList, new Comparator() { @@ -1014,4 +1048,199 @@ public class DataStatsServiceImpl implements DataStatsService { return new ArrayList<>(); } + /** + * @Param formDTO + * @Description 治理实况-当前组织治理指数 + * @author sun + */ + @Override + public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { + AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); + resultDTO.setAgencyId(formDTO.getAgencyId()); + 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 agencyIds = new ArrayList<>(); + agencyIds.add(formDTO.getAgencyId()); + List list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); + if (list.size() > NumConstant.ZERO) { + resultDTO = list.get(NumConstant.ZERO); + } + return resultDTO; + } + + /** + * @Param formDTO + * @Description 治理实况-组织直属下级治理指数列表 + * @author sun + */ + @Override + public List subAgencyGovrnList(AgencyGovrnFormDTO formDTO) { + List resultList = new ArrayList<>(); + 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)); + } + //排序类型,默认按问题解决总数降序 + if (StringUtils.isBlank(formDTO.getDateId())) { + formDTO.setType("problem"); + } + + //1.查询当前组织的直属下级组织信息【机关维度】 + List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + if (subAgencyList.size() < NumConstant.ONE) { + return resultList; + } + List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + + //2.按日期查询所有下级组织的事件治理指数 + List list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); + + //3.封装数据 + for (DimAgencyEntity sub : subAgencyList) { + AgencyGovrnResultDTO dto = new AgencyGovrnResultDTO(); + dto.setAgencyId(sub.getId()); + dto.setAgencyName(sub.getAgencyName()); + dto.setLevel(sub.getLevel()); + for (AgencyGovrnResultDTO re : list) { + if (sub.getId().equals(re.getAgencyId())) { + dto.setProblemResolvedCount(re.getProblemResolvedCount()); + dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); + dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); + dto.setCommunityResolvedRatio(re.getCommunityResolvedRatio()); + dto.setStreetResolvedRatio(re.getStreetResolvedRatio()); + dto.setDistrictDeptResolvedRatio(re.getDistrictDeptResolvedRatio()); + } + } + resultList.add(dto); + } + + //4.按要求排序并返回 + Collections.sort(resultList, new Comparator() { + @Override + public int compare(AgencyGovrnResultDTO o1, AgencyGovrnResultDTO o2) { + if ("party".equals(formDTO.getType())) { + return o2.getGroupSelfGovernRatio().compareTo(o1.getGroupSelfGovernRatio()); + } else if ("grid".equals(formDTO.getType())) { + return o2.getGridSelfGovernRatio().compareTo(o1.getGridSelfGovernRatio()); + } else if ("community".equals(formDTO.getType())) { + return o2.getCommunityResolvedRatio().compareTo(o1.getCommunityResolvedRatio()); + } else if ("department".equals(formDTO.getType())) { + return o2.getDistrictDeptResolvedRatio().compareTo(o1.getDistrictDeptResolvedRatio()); + } else if ("street".equals(formDTO.getType())) { + return o2.getStreetResolvedRatio().compareTo(o1.getStreetResolvedRatio()); + } else { + return o2.getProblemResolvedCount().compareTo(o1.getProblemResolvedCount()); + } + } + }); + + return resultList; + } + + /** + * @Param formDTO + * @Description 治理实况-当前网格治理指数 + * @author sun + */ + @Override + public GridGovrnResultDTO gridGovrn(GridGovrnFormDTO formDTO) { + GridGovrnResultDTO resultDTO = new GridGovrnResultDTO(); + 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 list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); + if (list.size() > NumConstant.ZERO) { + resultDTO = list.get(NumConstant.ZERO); + } + return resultDTO; + } + + /** + * @Param formDTO + * @Description 治理实况-组织直属网格治理指数列表 + * @author sun + */ + @Override + public List subGridGovrnList(GridGovrnFormDTO formDTO) { + List resultList = new ArrayList<>(); + 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)); + } + //排序类型,默认按问题解决总数降序 + if (StringUtils.isBlank(formDTO.getDateId())) { + formDTO.setType("problem"); + } + + //1.查询组织直属网格列表【网格维度】 + List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + if (gridList.size() < NumConstant.ONE) { + return resultList; + } + List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + + //2.按日期查找组织直属网格事件治理指数列表 + List list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); + + //3.封装数据 + for (DimGridEntity gr : gridList) { + GridGovrnResultDTO dto = new GridGovrnResultDTO(); + dto.setGridId(gr.getId()); + dto.setGridName(gr.getGridName()); + for (GridGovrnResultDTO re : list) { + if (gr.getId().equals(re.getGridId())) { + dto.setProblemResolvedCount(re.getProblemResolvedCount()); + dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); + dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); + } + } + resultList.add(dto); + } + + //4.按要求排序并返回 + Collections.sort(resultList, new Comparator() { + @Override + public int compare(GridGovrnResultDTO o1, GridGovrnResultDTO o2) { + if ("party".equals(formDTO.getType())) { + return o2.getGroupSelfGovernRatio().compareTo(o1.getGroupSelfGovernRatio()); + } else if ("grid".equals(formDTO.getType())) { + return o2.getGridSelfGovernRatio().compareTo(o1.getGridSelfGovernRatio()); + } else { + return o2.getProblemResolvedCount().compareTo(o1.getProblemResolvedCount()); + } + } + }); + + return resultList; + } + } 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 1f1663bd49..7097ca36c5 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 @@ -612,4 +612,43 @@ WHERE ID = #{agencyId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java new file mode 100644 index 0000000000..5d35359bc7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格的治理指数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +@Mapper +public interface FactGridGovernDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java index c1b8e5b479..b4b6fc8869 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CpcScoreResultDTO; import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity; +import com.epmet.model.AvgOperationResultVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -46,9 +47,9 @@ public interface CpcScoreDao extends BaseDao { * @description 获取网格内党员的联系群众能力考评分(平均值) * @Date 2020/8/31 10:56 **/ - BigDecimal selectGridContactMassesAvgValue(@Param("customerId") String customerId, - @Param("monthId") String monthId, - @Param("gridId") String gridId); + AvgOperationResultVO selectGridContactMassesAvgValue(@Param("customerId") String customerId, + @Param("monthId") String monthId, + @Param("gridId") String gridId); /** * @param formDTO @@ -77,7 +78,7 @@ public interface CpcScoreDao extends BaseDao { * @description 组织内党员的参与议事能力考评分(平均值) * @Date 2020/8/31 15:51 **/ - BigDecimal selectGridJoinIssueAvgValue(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridId") String gridId); + AvgOperationResultVO selectGridJoinIssueAvgValue(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridId") String gridId); int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("indexCode") String indexCode, @Param("deleteSize") Integer deleteSize, @Param("isTotal") String isTotal); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java new file mode 100644 index 0000000000..0fcff9c663 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java @@ -0,0 +1,135 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 网格的治理指数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_govern_daily") +public class FactGridGovernDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属的组织id + */ + private String pid; + + /** + * 网格所有上级id + */ + private String pids; + + /** + * 界面展示:问题解决总数=1+2+3+4+5+6+7+8 + */ + private Integer problemResolvedCount; + + /** + * 界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数 + */ + private BigDecimal groupSelfGovernRatio; + + /** + * 界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal gridSelfGovernRatio; + + /** + * 1、当前网格内,话题关闭已解决数 + */ + private Integer topicResolvedCount; + + /** + * 2、当前网格内,话题关闭无需解决数 + */ + private Integer topicUnResolvedCount; + + /** + * 3、当前网格内,议题关闭已解决数 + */ + private Integer issueResolvedCount; + + /** + * 4、当前网格内,议题关闭无需解决数 + */ + private Integer issueUnResolvedCount; + + /** + * 5、当前网格内:来源于议题的项目:结案已解决数 + */ + private Integer issueProjectResolvedCount; + + /** + * 6、当前网格内:来源于议题的项目:结案无需解决数 + */ + private Integer issueProjectUnResolvedCount; + + /** + * 7、当前网格内:项目立项,结案已解决数;默认为0, + */ + private Integer approvalProjectResolvedCount; + + /** + * 8、当前网格内:项目立项,结案无需解决数;默认为0, + */ + private Integer approvalProjectUnResolvedCount; + + /** + * 9、当前网格内,未出小组即未转议题的:话题关闭已解决数 + */ + private Integer inGroupTopicResolvedCount; + + /** + * 10、当前网格内,未出小组即未转议题的:话题关闭无需解决数 + */ + private Integer inGroupTopicUnResolvedCount; + + /** + * 未出当前网格的,结案项目数 + */ + private Integer gridSelfGovernProjectTotal; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java index fa88df4ba7..f6bf4bb903 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java @@ -101,4 +101,9 @@ public class GridSubScoreEntity extends BaseEpmetEntity { * 权重(同一组权重总和=1) */ private BigDecimal weight; + + /** + * 样本总量 + */ + private Integer sampleCount; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/AvgOperationResultVO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/AvgOperationResultVO.java new file mode 100644 index 0000000000..d97ad2e264 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/AvgOperationResultVO.java @@ -0,0 +1,21 @@ +package com.epmet.model; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 平均值运算结果vo + */ +@Data +public class AvgOperationResultVO { + /** + * 样本量 + */ + private Integer sampleCount; + + /** + * 平均值 + */ + private BigDecimal avgValue; +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java new file mode 100644 index 0000000000..d5ffd39cd4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; + +/** + * 网格的治理指数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +public interface FactGridGovernDailyService extends BaseService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java new file mode 100644 index 0000000000..99e73d3603 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.evaluationindex.extract.FactGridGovernDailyDao; +import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import org.springframework.stereotype.Service; + +/** + * 网格的治理指数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +@Service +public class FactGridGovernDailyServiceImpl extends BaseServiceImpl implements FactGridGovernDailyService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index b785d78b4a..e70200f06a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; import com.epmet.eum.IndexCodeEnum; +import com.epmet.model.AvgOperationResultVO; import com.epmet.service.evaluationindex.indexcal.GridCorreLationService; import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; @@ -185,6 +186,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { **/ @Transactional(rollbackFor = Exception.class) public void calculateGridDangJian(CalculateCommonFormDTO formDTO) { + // 该客户下的指标列表及权重 List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); @@ -192,7 +194,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { log.error("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); throw new RenException("客户【网格相关:党建能力】指标权重信息不存在"); } - //查询总记录数 + //查询总记录数(该客户下,该月份,每个网格一条,有多少条) int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO); if (NumConstant.ZERO == total) { log.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); @@ -210,10 +212,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //指标集合 Map> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList = new ArrayList<>(); + // 平均值计算结果,内含平均值,样本总量 + HashMap gridAvgOpeResultMap = new HashMap<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; - //前10条 + //前10条。每个网格的党建能力的数据 List> recordList = queryListPartyAblityGrid(new PageQueryGridFormDTO(formDTO.getCustomerId(), formDTO.getMonthId(), pageIndex, @@ -231,8 +235,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { // log.info("组织内党员的联系群众能力考评分(平均值) 单独处理"); //网格内党员的联系群众能力考评分(平均值) String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); - BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(formDTO, gridId); - SampleValue contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgValue); + String monthId = (String) recordMap.get(IndexCalConstant.MONTH_ID); + AvgOperationResultVO contactMassesAvgVo = getGridContactMassesAvgValue(formDTO, gridId); + gridAvgOpeResultMap.put(gridId.concat(":").concat(monthId), contactMassesAvgVo); + SampleValue contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgVo.getAvgValue()); value.getIndexValueVOs().add(contactMassesAblityValue); }else if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { //对应的数值 @@ -251,7 +257,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), - NumConstant.ZERO_STR); + NumConstant.ZERO_STR, + gridAvgOpeResultMap); + + // 清理map + gridAvgOpeResultMap.clear(); } /** @@ -312,10 +322,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @description 获取网格(组织)内党员的联系群众能力考评分(平均值) * @Date 2020/8/31 9:50 **/ - private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { - BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); + private AvgOperationResultVO getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { + AvgOperationResultVO result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); if (null == result) { - return new BigDecimal(NumConstant.ZERO_STR); + result.setAvgValue(new BigDecimal(0)); + result.setSampleCount(0); } //FOR TEST /*BigDecimal result=null; @@ -337,10 +348,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @description 组织内党员的参与议事能力考评分(平均值) * @Date 2020/8/31 15:51 **/ - private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { - BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); + private AvgOperationResultVO getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { + AvgOperationResultVO result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); if (null == result) { - return new BigDecimal(NumConstant.ZERO_STR); + //return new BigDecimal(NumConstant.ZERO_STR); + result.setSampleCount(0); + result.setAvgValue(new BigDecimal(0)); } //FOR TEST /*BigDecimal result=null; @@ -411,7 +424,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { /** * @param formDTO 客户id 月份id: yyyyMM - * @param resultMapList + * @param resultMapList key:网格id,value:该网格各项指标的计算结果 * @param indexCode 指标编码: 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; * @param isTotal 1:总分;0不是 * @return void @@ -422,7 +435,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { private void saveGridCorreLationResult(CalculateCommonFormDTO formDTO, List> resultMapList, String indexCode, - String isTotal) { + String isTotal, + HashMap avgOpeResultVo) { String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId()); //三大能力结果表 @@ -463,6 +477,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { gridSubScoreEntity.setScore(detail.getScore()); gridSubScoreEntity.setWeight(detail.getWeight()); gridSubScoreEntity.setOriginValue(detail.getOriginValue()); + + // 为平均值类型的指标赋值样本总量 + AvgOperationResultVO avgOperationResultVO = avgOpeResultVo.get(gridSubScoreEntity.getGridId().concat(":").concat(gridSubScoreEntity.getMonthId())); + if (avgOperationResultVO != null) { + gridSubScoreEntity.setSampleCount(avgOperationResultVO.getSampleCount()); + } else { + gridSubScoreEntity.setSampleCount(0); + } gridSubScoreList.add(gridSubScoreEntity); } }); @@ -621,6 +643,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //指标集合 Map> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList = new ArrayList<>(); + HashMap avgOperationResultVo = new HashMap<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; @@ -639,8 +662,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(key)) { // log.info("组织内党员的参与议事能力考评分(平均值) 单独处理"); String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); - BigDecimal joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId); - SampleValue contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue); + String monthId = (String) recordMap.get(IndexCalConstant.MONTH_ID); + AvgOperationResultVO joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId); + avgOperationResultVo.put(gridId.concat(":").concat(monthId), joinAvgValue); + + SampleValue contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue.getAvgValue()); value.getIndexValueVOs().add(contactMassesAblityValue); }else if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { //对应的数值 @@ -659,7 +685,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), - NumConstant.ZERO_STR); + NumConstant.ZERO_STR, + avgOperationResultVo); } @@ -696,6 +723,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //指标集合 Map> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList = new ArrayList<>(); + HashMap avgOperationResultVO = new HashMap<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; @@ -730,7 +758,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.FU_WU_NENG_LI.getCode(), - NumConstant.ZERO_STR); + NumConstant.ZERO_STR, + avgOperationResultVO); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__cpc_subscore_add_samplecount.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__cpc_subscore_add_samplecount.sql new file mode 100644 index 0000000000..af7688ee68 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__cpc_subscore_add_samplecount.sql @@ -0,0 +1 @@ +alter table fact_index_grid_sub_score add column SAMPLE_COUNT int(10) comment '样本量' after ORIGIN_VALUE; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql new file mode 100644 index 0000000000..ee35df8d10 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql @@ -0,0 +1,49 @@ +-- epmet_data_statistical 库执行以下脚本 +-- CREATE TABLE `fact_group_act_daily` ( +-- `ID` varchar(64) NOT NULL COMMENT '主键', +-- `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', +-- `DATE_ID` varchar(8) NOT NULL COMMENT '数据更新至日期Id:yyyyMMdd', +-- `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', +-- `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', +-- `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', +-- `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', +-- `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', +-- `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', +-- `LEVEL` int(11) NOT NULL COMMENT '分类等级', +-- `ORGANIZE_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 组织次数;包含dateId这一天的数据', +-- `PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 参加人数;包含dateId这一天的数据', +-- `AVG_PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 平均参加人数;包含dateId这一天的数据', +-- `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', +-- `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', +-- `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', +-- `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', +-- `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', +-- `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', +-- PRIMARY KEY (`ID`) USING BTREE +-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='组织活动(参加人数、组织次数、平均参加人数)按天累计值分析'; + + + + +-- CREATE TABLE `fact_group_act_monthly` ( +-- `ID` varchar(64) NOT NULL COMMENT '主键', +-- `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', +-- `MONTH_ID` varchar(8) NOT NULL COMMENT '数据维度:yyyyMM', +-- `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', +-- `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', +-- `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', +-- `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', +-- `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', +-- `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', +-- `LEVEL` int(11) NOT NULL COMMENT '分类等级', +-- `ORGANIZE_INCR` int(11) NOT NULL COMMENT '本月内:活动组织次数', +-- `PARTICIPATE_USER__INCR` int(11) NOT NULL COMMENT '本月内:活动签到人数参加人数', +-- `AVG_PARTICIPATE_USER_INCR` int(11) NOT NULL COMMENT '本月内:平均参加人数', +-- `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', +-- `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', +-- `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', +-- `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', +-- `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', +-- `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', +-- PRIMARY KEY (`ID`) USING BTREE +-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='专项组活动(参加人数、组织次数、平均参加人数)按月增量分析'; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml new file mode 100644 index 0000000000..6fa56797fa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml index bf0cfd3d51..b4ad476821 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml @@ -46,9 +46,10 @@ - SELECT - round(AVG( SCORE ),6) AS AVG_CONTACT_MASSES_SCORE + round(AVG( SCORE ),6) AS AVG_VALUE, + count(1) AS SAMPLE_COUNT FROM fact_index_cpc_score m WHERE @@ -90,9 +91,10 @@ - SELECT - round(AVG( SCORE ),6) AS AVG_CONTACT_MASSES_SCORE + round(AVG( SCORE ),6) AS AVG_VALUE, + count(1) AS SAMPLE_COUNT FROM fact_index_cpc_score m WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml index 056f92afb2..8d39d8dcc3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml @@ -24,7 +24,8 @@ `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, - `UPDATED_TIME` + `UPDATED_TIME`, + `SAMPLE_COUNT` ) VALUES @@ -47,7 +48,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.sampleCount} )