From c89fe0d9289abeb333cc741806f1e6d216790f8e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 27 Sep 2020 14:08:05 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E5=85=9A=E5=BB=BA=E5=BC=95=E9=A2=86?= =?UTF-8?q?=E3=80=90=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0=EF=BC=8C=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E4=BA=BA=E6=95=B0=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ScreenPartyBranchDataFormDTO.java | 3 ++ .../epmet/dao/heart/ActUserRelationDao.java | 2 +- .../toscreen/impl/PartyGuideServiceImpl.java | 51 +++++++++++++++---- .../service/heart/ActUserRelationService.java | 2 +- .../impl/ActUserRelationServiceImpl.java | 4 +- .../screen/ScreenPartyBranchDataDao.xml | 8 +-- .../mapper/heart/ActUserRelation.xml | 2 +- 7 files changed, 53 insertions(+), 19 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java index 06b95d02d2..72f9456cf8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java @@ -88,6 +88,9 @@ public class ScreenPartyBranchDataFormDTO implements Serializable { private String updatedBy; public ScreenPartyBranchDataFormDTO() { + this.organizeCount = NumConstant.ZERO; + this.joinUserCount = NumConstant.ZERO; + this.averageJoinUserCount = NumConstant.ZERO; this.delFlag = NumConstant.ZERO_STR; this.revision = NumConstant.ZERO; this.createdBy = "APP_USER"; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java index 32cbbaf408..a88a330439 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java @@ -20,6 +20,6 @@ public interface ActUserRelationDao { * @author zxc * @date 2020/9/25 5:19 下午 */ - List selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId); + List selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("orgType") String orgType); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index aac1f632bf..12a37d90a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -76,7 +76,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { } String monthId = screenExtractFormDTO.getMonthId(); if (StringUtils.isEmpty(monthId)){ - monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); + monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); } if (!CollectionUtils.isEmpty(customerIds)){ String finalMonthId = monthId; @@ -273,8 +273,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (!CollectionUtils.isEmpty(agencyIdList)){ List result = new ArrayList<>(); List orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + List joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); + List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); if (isGrid == true){ - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); agencyIdList.forEach(agency -> { String agencyId = agency.getAgencyId(); Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); @@ -286,7 +288,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { joinUserCountList.forEach(join -> { if (party.getOrgId().equals(join.getOrgId())){ party.setAverageJoinUserCount(join.getJoinUserCount()); - party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); + party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); party.setYearId(DateUtils.getYearId(monthId)); } }); @@ -314,7 +316,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setYearId(DateUtils.getYearId(monthId)); form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); - form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); result.add(form); }); delAndInsertOrganize(result,customerId,monthId,orgIds); @@ -330,15 +342,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); // 存在直属网格 if (!CollectionUtils.isEmpty(disGridIds)){ + orgIds.addAll(disGridIds); List gridResult = new ArrayList<>(); - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); - List orgNameList = agencyService.selectOrgNameGrid(disGridIds); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ screenPartyBranchDataList.forEach(party -> { - orgNameList.forEach(org -> { - if (party.getOrgId().equals(org.getGridId())){ - party.setOrgName(org.getGridName()); + joinUserCountList.forEach(join -> { + if (party.getOrgId().equals(join.getOrgId())){ + party.setAverageJoinUserCount(join.getJoinUserCount()); + party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); + party.setYearId(DateUtils.getYearId(monthId)); } }); ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); @@ -360,7 +374,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId()); form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); - form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); result.add(form); } }); @@ -369,6 +393,13 @@ public class PartyGuideServiceImpl implements PartyGuideService { } } + public Integer calAdd(Integer a, Integer b){ + if (null != a && null != b){ + return a + b; + } + return NumConstant.ZERO; + } + /** * @Description 社区级别的处理 * @Param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java index 7875323b3c..c7cb47c47a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java @@ -17,6 +17,6 @@ public interface ActUserRelationService { * @author zxc * @date 2020/9/25 5:19 下午 */ - List selectJoinUserCount(String customerId,String monthId); + List selectJoinUserCount(String customerId,String monthId, String orgType); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java index 570967a3c0..b9b5165260 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java @@ -29,7 +29,7 @@ public class ActUserRelationServiceImpl implements ActUserRelationService { * @date 2020/9/25 5:19 下午 */ @Override - public List selectJoinUserCount(String customerId, String monthId) { - return actUserRelationDao.selectJoinUserCount(customerId, monthId); + public List selectJoinUserCount(String customerId, String monthId, String orgType) { + return actUserRelationDao.selectJoinUserCount(customerId, monthId, orgType); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml index ae9430e214..5c5741a289 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml @@ -128,8 +128,8 @@ From 39788c9bc2d2e08a167e6bd81f8fdcc09c09e714 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 27 Sep 2020 14:33:20 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=B9=E7=89=88?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=8F=82=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/result/IndexDictResultDTO.java | 30 ++++++ .../datareport/constant/FactConstant.java | 16 ++++ .../datareport/dao/fact/IndexDictDao.java | 49 ++++++++++ .../fact/impl/FactIndexServiceImpl.java | 96 +++++++++++++++---- .../fact/FactIndexAgencySubScoreDao.xml | 4 +- .../fact/FactIndexCommunitySubScoreDao.xml | 4 +- .../mapper/fact/FactIndexGridSubScoreDao.xml | 4 +- .../resources/mapper/fact/IndexDictDao.xml | 31 ++++++ 8 files changed, 212 insertions(+), 22 deletions(-) create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java new file mode 100644 index 0000000000..196837f220 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 评价指标字典表数据--接口返参 + * @Author sun + */ +@Data +public class IndexDictResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 指标名 + */ + private String indexName; + /** + * 指标code + */ + private String indexCode; + /** + * 指标值类型 百分比:percent + */ + private String valueType; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java index 70c5614f65..4e2449c81c 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java @@ -45,4 +45,20 @@ public interface FactConstant { * 网格相关 */ String WANG_GE_XIANG_GUAN = "wanggexiangguan"; + /** + * 评价指标类型-无 + */ + String NONE = "none"; + /** + * 评价指标类型-整数 + */ + String INTEGER = "integer"; + /** + * 评价指标类型-小数 + */ + String DECIMAL = "decimal"; + /** + * 评价指标类型-百分比 + */ + String PERCENT = "percent"; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java new file mode 100644 index 0000000000..893820cf1c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java @@ -0,0 +1,49 @@ +/** + * 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.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface IndexDictDao { + + /** + * @param + * @Description 查询指标字典表是百分比类型的数据 + * @author sun + */ + List selectList(); + + /** + * @param + * @Description 根据indexCode查询指标字典表具体数据 + * @author sun + */ + IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 523bf3a7e5..68b3fd1f60 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -15,12 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.LinkedList; -import java.util.List; +import java.util.*; /** * 数据改版api @@ -47,6 +45,8 @@ public class FactIndexServiceImpl implements FactIndexService { private FactIndexGridScoreDao factIndexGridScoreDao; @Autowired private FactIndexGridSubScoreDao factIndexGridSubScoreDao; + @Autowired + private IndexDictDao indexDictDao; /** * @param formDTO @@ -125,19 +125,27 @@ public class FactIndexServiceImpl implements FactIndexService { AblityIndexResultDTO nl = new AblityIndexResultDTO(); nl.setIndexCode(FactConstant.NLZB); nl.setScoreList(nlList); - if(null != nlList){resultList.add(nl);} + if (null != nlList) { + resultList.add(nl); + } AblityIndexResultDTO dj = new AblityIndexResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); - if(null != djList){resultList.add(dj);} + if (null != djList) { + resultList.add(dj); + } AblityIndexResultDTO zl = new AblityIndexResultDTO(); zl.setIndexCode(FactConstant.ZLNL); zl.setScoreList(zlList); - if(null != zlList){resultList.add(zl);} + if (null != zlList) { + resultList.add(zl); + } AblityIndexResultDTO fw = new AblityIndexResultDTO(); fw.setIndexCode(FactConstant.FWNL); fw.setScoreList(fwList); - if(null != fwList){resultList.add(fw);} + if (null != fwList) { + resultList.add(fw); + } return resultList; } @@ -203,9 +211,15 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } //5.封装数据并返回 - if(null != dj){resultList.add(dj);} - if(null != zl){resultList.add(zl);} - if(null != fw){resultList.add(fw);} + if (null != dj) { + resultList.add(dj); + } + if (null != zl) { + resultList.add(zl); + } + if (null != fw) { + resultList.add(fw); + } return resultList; } @@ -278,15 +292,21 @@ public class FactIndexServiceImpl implements FactIndexService { MonthScoreListResultDTO dj = new MonthScoreListResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); - if(null != djList){resultList.add(dj);} + if (null != djList) { + resultList.add(dj); + } MonthScoreListResultDTO zl = new MonthScoreListResultDTO(); zl.setIndexCode(FactConstant.ZLNL); zl.setScoreList(zlList); - if(null != zlList){resultList.add(zl);} + if (null != zlList) { + resultList.add(zl); + } MonthScoreListResultDTO fw = new MonthScoreListResultDTO(); fw.setIndexCode(FactConstant.FWNL); fw.setScoreList(fwList); - if(null != fwList){resultList.add(fw);} + if (null != fwList) { + resultList.add(fw); + } return resultList; } @@ -333,7 +353,28 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //4.调用方法判断各项指标是数字指标还是百分比指标 //TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数 + //4.查询指标字典表数据 + List list = indexDictDao.selectList(); + //5.遍历数据,判断数据类型并处理 + /*NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1);*/ + resultList.forEach(result -> { + list.forEach(l -> { + if (result.getKey().equals(l.getIndexCode())) { + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num.toString()); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num+"%"); + } + } + }); + }); + return resultList; } @@ -373,7 +414,30 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //6.调用方法判断各项指标是数字指标还是百分比指标//TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数 + //6.查询指标字典表具体数据 + IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey()); + if (null == dictDTO) { + throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey())); + } + + //7.遍历数据,判断数据类型并处理 + /*NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1);*/ + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(dictDTO.getValueType())) { + resultList.forEach(result -> { + BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setAblity(num.toString()); + }); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(dictDTO.getValueType())) { + resultList.forEach(result -> { + BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setAblity(num+"%"); + }); + } + return resultList; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml index 879d8b521e..9744157016 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_agency_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml index 8c8e780259..197b6f9bf9 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_community_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml index d48f24966e..1b317e2791 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_grid_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml new file mode 100644 index 0000000000..0784877dda --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + From 1bd155ffc1b5a42850c1243f43f838fdf9cefe46 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 27 Sep 2020 14:45:59 +0800 Subject: [PATCH 03/21] =?UTF-8?q?screen=5Fpublic=5Fparti=5Ftotal=5Fdata?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E=E5=90=84=E7=B1=BB=E6=80=BB?= =?UTF-8?q?=E6=95=B0v0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginIssueLogDailyDao.java | 12 ++++ .../screen/ScreenPublicPartiTotalDataDao.java | 9 +++ .../screen/ScreenUserTotalDataDao.java | 9 +++ .../ScreenPublicPartiTotalDataEntity.java | 2 +- .../FactOriginIssueLogDailyService.java | 10 +++ .../FactOriginIssueLogDailyServiceImpl.java | 37 +++++++++- .../PublicPartiTotalDataExtractService.java | 19 ++++++ ...ublicPartiTotalDataExtractServiceImpl.java | 68 +++++++++++++++++++ .../ScreenPublicPartiTotalDataService.java | 11 +++ .../screen/ScreenUserTotalDataService.java | 9 +++ ...ScreenPublicPartiTotalDataServiceImpl.java | 31 +++++++++ .../impl/ScreenUserTotalDataServiceImpl.java | 13 +++- .../extract/FactOriginIssueLogDailyDao.xml | 19 ++++++ .../screen/ScreenPublicPartiTotalDataDao.xml | 47 ++++++++++++- .../screen/ScreenUserTotalDataDao.xml | 8 +++ 15 files changed, 300 insertions(+), 4 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PublicPartiTotalDataExtractService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 9ac027b1fa..9b89222731 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -89,4 +89,16 @@ public interface FactOriginIssueLogDailyDao extends BaseDao list, @Param("customerId")String customerId); + + /** + * @return void + * @param list + * @author yinzuomei + * @description 批量插入entity + * @Date 2020/9/27 14:00 + **/ + void insertBatchEntity(@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java index 2456d0d93a..d877d0042d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java @@ -57,4 +57,13 @@ public interface ScreenUserTotalDataDao extends BaseDao list, @Param("customerId")String customerId); void insertBatch(@Param("list") List list); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 根据条件查询screen_user_total_data表 + * @Date 2020/9/27 11:22 + **/ + List selectList(@Param("customerId") String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java index 3f38146cc6..b0c78254e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java @@ -86,7 +86,7 @@ public class ScreenPublicPartiTotalDataEntity extends BaseEpmetEntity { private Integer regUserTotal; /** - * 参与人数 + * 参与人数参与人数: 议题的表决行为的用户数去重的累计值 */ private Integer joinUserTotal; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 671888fb14..a6376e27dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -40,4 +40,14 @@ public interface FactOriginIssueLogDailyService extends BaseService implements FactOriginIssueLogDailyService { - + @Autowired + private DimAgencyService dimAgencyService; /** * @param customerId @@ -51,4 +59,31 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl userTotalDataEntityList = screenUserTotalDataService.selectList(customerId); + if (CollectionUtils.isEmpty(userTotalDataEntityList)) { + log.warn("screen_user_total_data dosen't have any record "); + return; + } + List list = new ArrayList<>(); + for (ScreenUserTotalDataEntity totalData : userTotalDataEntityList) { + ScreenPublicPartiTotalDataEntity entity = new ScreenPublicPartiTotalDataEntity(); + entity.setCustomerId(customerId); + entity.setOrgType(totalData.getOrgType()); + entity.setOrgId(totalData.getOrgId()); + entity.setParentId(totalData.getParentId()); + entity.setOrgName(totalData.getOrgName()); + entity.setDataEndTime(dateId); + entity.setTopicTotal(totalData.getTopicTotal()); + entity.setIssueTotal(totalData.getIssueTotal()); + entity.setProjectTotal(totalData.getProjectTotal()); + entity.setRegUserTotal(totalData.getUserTotal()); + //参与人数参与人数: 议题的表决行为的用户数去重的累计值 + int joinUserTotal=factOriginIssueLogDailyService.queryJoinUserTotal(customerId,totalData.getOrgType(),totalData.getOrgId()); + entity.setJoinUserTotal(joinUserTotal); + list.add(entity); + } + //先删除,后插入 + screenPublicPartiTotalDataService.delAndInsertBatch(customerId, list); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java index 4e804628cc..0e03f4d555 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java @@ -21,6 +21,8 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; +import java.util.List; + /** * 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数 * @@ -28,4 +30,13 @@ import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; * @since v1.0.0 2020-09-22 */ public interface ScreenPublicPartiTotalDataService extends BaseService { + /** + * @return void + * @param customerId + * @param list screen_public_parti_total_data 记录 + * @author yinzuomei + * @description 先删除,后插入 + * @Date 2020/9/27 13:51 + **/ + void delAndInsertBatch(String customerId, List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java index 3f38a3a683..313de8c061 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java @@ -40,4 +40,13 @@ public interface ScreenUserTotalDataService extends BaseService list,String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 根据条件查询screen_user_total_data表 + * @Date 2020/9/27 11:18 + **/ + List selectList(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java index f0b888967e..fdc231a5d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java @@ -19,10 +19,17 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.screen.ScreenPublicPartiTotalDataDao; import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; import com.epmet.service.evaluationindex.screen.ScreenPublicPartiTotalDataService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; /** * 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数 @@ -34,4 +41,28 @@ import org.springframework.stereotype.Service; public class ScreenPublicPartiTotalDataServiceImpl extends BaseServiceImpl implements ScreenPublicPartiTotalDataService { + /** + * @param customerId + * @param entityList screen_public_parti_total_data 记录 + * @return void + * @author yinzuomei + * @description 先删除,后插入 + * @Date 2020/9/27 13:51 + **/ + @Transactional(rollbackFor = Exception.class) + @Override + public void delAndInsertBatch(String customerId, List entityList) { + if(CollectionUtils.isEmpty(entityList)){ + return; + } + int deleteNum=0; + do{ + //沿用原来项目采集的删除方法,一次删除1000 + deleteNum=baseDao.deletePublicPartiTotalData(customerId); + }while (deleteNum!= NumConstant.ZERO); + List> partionList= ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE); + partionList.forEach(list->{ + baseDao.insertBatchEntity(list); + }); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java index a1b21beced..b21e39c716 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java @@ -23,7 +23,6 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.dao.evaluationindex.screen.ScreenUserTotalDataDao; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; import com.epmet.service.evaluationindex.screen.ScreenUserTotalDataService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -56,4 +55,16 @@ public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl + * @author yinzuomei + * @description 根据条件查询screen_user_total_data表 + * @Date 2020/9/27 11:18 + **/ + @Override + public List selectList(String customerId) { + return baseDao.selectList(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 734f088d09..85c927d5c3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -119,4 +119,23 @@ and M.IS_PARTY=#{isParty} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml index 0c2bfa9c51..1b33f8b0ea 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml @@ -77,5 +77,50 @@ - + + + insert into screen_public_parti_total_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + TOPIC_TOTAL, + ISSUE_TOTAL, + PROJECT_TOTAL, + REG_USER_TOTAL, + JOIN_USER_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.topicTotal}, + #{item.issueTotal}, + #{item.projectTotal}, + #{item.regUserTotal}, + #{item.joinUserTotal}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml index e8c0e8c660..c3b3ef7de7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml @@ -105,4 +105,12 @@ + + From 837b9468926e505c5633b98e4e480854c23cd09a Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 15:22:05 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/GridGroupUserCountResultDTO.java | 30 +++ .../result/IssueVoteStatisticalResultDTO.java | 68 ++++++ .../result/IssueVoteUserCountResultDTO.java | 26 ++ .../extract/FactOriginGroupMainDailyDao.java | 69 +++--- .../extract/FactOriginIssueLogDailyDao.java | 42 ++-- .../com/epmet/dao/issue/StatsIssueDao.java | 229 ++++++++++-------- .../com/epmet/service/Issue/IssueService.java | 37 ++- .../service/Issue/impl/IssueServiceImpl.java | 30 ++- .../FactOriginGroupMainDailyService.java | 17 +- .../FactOriginIssueLogDailyService.java | 24 +- .../FactOriginGroupMainDailyServiceImpl.java | 11 +- .../FactOriginIssueLogDailyServiceImpl.java | 9 +- .../impl/PublicPartExtractServiceImpl.java | 49 +++- .../extract/FactOriginGroupMainDailyDao.xml | 15 ++ .../extract/FactOriginIssueLogDailyDao.xml | 16 ++ 15 files changed, 482 insertions(+), 190 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteStatisticalResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java new file mode 100644 index 0000000000..72723e1987 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: 网格级别小组内的组成员数 + * + * @author LiuJanJun + * @date 2020/9/27 2:27 下午 + */ +@Data +public class GridGroupUserCountResultDTO implements Serializable { + + + private static final long serialVersionUID = -4729061928990808187L; + /** + * 客户ID + */ + private String customerId; + + private String gridId; + + private Integer memberCount; + /** + * 网格的pids + */ + private String pids; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteStatisticalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteStatisticalResultDTO.java new file mode 100644 index 0000000000..01531e3bb1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteStatisticalResultDTO.java @@ -0,0 +1,68 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * desc: 议题投票统计结果DTO + * + * @author LiuJanJun + * @date 2020/9/27 11:22 上午 + */ +@Data +public class IssueVoteStatisticalResultDTO implements Serializable { + + + private static final long serialVersionUID = 2631108929053690349L; + /** + * 主键ID + */ + private String id; + + /** + * 议题ID + */ + private String issueId; + + /** + * 统计日期 yyyy-MM-dd + */ + private Date statisticalDate; + + /** + * 到该日的总赞成数 + */ + private Integer supportCount; + + /** + * 到该日的总反对数 + */ + private Integer oppositionCount; + + /** + * 到该日的总票数 + */ + private Integer totalCount; + + /** + * 该日增量 + */ + private Integer todayIncrement; + + /** + * 该日赞成增量 + */ + private Integer supportIncrement; + + /** + * 该日反对增量 + */ + private Integer oppositionIncrement; + + /** + * 到该日的应表决数 + */ + private Integer votableCount; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java new file mode 100644 index 0000000000..405ab7b3a8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: 议题投票人数 + * + * @author LiuJanJun + * @date 2020/9/27 2:27 下午 + */ +@Data +public class IssueVoteUserCountResultDTO implements Serializable { + + + private static final long serialVersionUID = -4729061928990808187L; + private String gridId; + private String issueId; + private Integer voteCount; + private Integer issueCount; + /** + * 网格的pids + */ + private String pids; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index 66a156557d..5107262311 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -18,16 +18,16 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; -import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; - import java.util.List; /** @@ -40,86 +40,87 @@ import java.util.List; public interface FactOriginGroupMainDailyDao extends BaseDao { /** - * @Description 查询建群党员数 * @param customerId * @param monthId + * @Description 查询建群党员数 * @author zxc * @date 2020/9/19 3:49 下午 */ - List selectPartyCreateGroupCount(@Param("customerId") String customerId,@Param("monthId") String monthId); + List selectPartyCreateGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId); /** - * @Description 查询是否存在该客户下的数据 * @param customerId * @return + * @Description 查询是否存在该客户下的数据 * @author wangc * @date 2020.09.18 23:30 - **/ - int selectIfExist(@Param("customerId")String customerId); + **/ + int selectIfExist(@Param("customerId") String customerId); /** - * @Description 按照客户Id清除组数据 * @param customerId * @return + * @Description 按照客户Id清除组数据 * @author wangc * @date 2020.09.20 09:58 - **/ - void deleteBatchByCustomerId(@Param("customerId")String customerId); + **/ + void deleteBatchByCustomerId(@Param("customerId") String customerId); /** - * @Description 按照客户Id清除组员数据 * @param customerId * @return + * @Description 按照客户Id清除组员数据 * @author wangc * @date 2020.09.20 09:58 **/ - void deleteBatchMemberByCustomerId(@Param("customerId")String customerId,@Param("dimId") String dimId,@Param("dateType") String dateType); + void deleteBatchMemberByCustomerId(@Param("customerId") String customerId, @Param("dimId") String dimId, @Param("dateType") String dateType); /** - * @Description 按照组Id清除组和组员数据 * @param customerId * @return + * @Description 按照组Id清除组和组员数据 * @author wangc * @date 2020.09.20 12:16 - **/ - void deleteBatchByGroupId(@Param("customerId")String customerId,@Param("list") List list); + **/ + void deleteBatchByGroupId(@Param("customerId") String customerId, @Param("list") List list); /** - * @Description 更新群主的党员信息 * @param list * @return + * @Description 更新群主的党员信息 * @author wangc * @date 2020.09.20 12:44 - **/ - int updatePartyFlag(@Param("list") List list,@Param("customerId")String customerId); + **/ + int updatePartyFlag(@Param("list") List list, @Param("customerId") String customerId); /** - * @Description 更新群主的热心居民信息 * @param list * @return + * @Description 更新群主的热心居民信息 * @author wangc * @date 2020.09.20 12:44 - **/ - int updateHeartedFlag(@Param("list") List list,@Param("customerId")String customerId); + **/ + int updateHeartedFlag(@Param("list") List list, @Param("customerId") String customerId); /** - * @Description 批量插入组主表 * @param list * @return + * @Description 批量插入组主表 * @author wangc * @date 2020.09.20 15:37 - **/ + **/ int insertBatchMain(@Param("list") List list); /** - * @Description 批量插入组员表 * @param list * @return + * @Description 批量插入组员表 * @author wangc * @date 2020.09.20 15:37 - **/ + **/ int insertBatchMembers(List list); + /** * @param customerId * @param groupOwnerId @@ -131,8 +132,8 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectGroupIds(@Param("customerId") String customerId, @Param("groupOwnerId") String groupOwnerId); /** - * @return java.util.List * @param groupIdList + * @return java.util.List * @author yinzuomei * @description 查询组成员数(去重) * @Date 2020/9/20 21:29 @@ -140,11 +141,21 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectGroupMemberList(@Param("list") List groupIdList); /** - * @Description 查询党员建组信息 * @param customerId * @param monthId + * @Description 查询党员建组信息 * @author zxc * @date 2020/9/25 9:46 上午 */ - List selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("monthId") String monthId,@Param("gridIds") List gridIds); + List selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridIds") List gridIds); + + /** + * desc: 获取所有网格的组中成员人数 去重 + * + * @param customerId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 2:31 下午 + */ + List selectDistinctGroupMemberCount(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 9b89222731..793926e513 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.IssueLogDailyFormDTO; +import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -27,7 +28,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 议题记录附表 + * 议题记录附表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-14 @@ -36,50 +37,50 @@ import java.util.List; public interface FactOriginIssueLogDailyDao extends BaseDao { /** - * @Description 议题记录附表插入 * @param issueLogList + * @Description 议题记录附表插入 * @author zxc * @date 2020/9/14 5:53 下午 */ - void insertIssueLogList(@Param("issueLogList")List issueLogList); + void insertIssueLogList(@Param("issueLogList") List issueLogList); /** - * @Description 删除旧的记录 * @param customerId * @param dateId + * @Description 删除旧的记录 * @author zxc * @date 2020/9/16 9:33 上午 */ - void deleteOldLogRecord(@Param("customerId")String customerId,@Param("dateId")String dateId); + void deleteOldLogRecord(@Param("customerId") String customerId, @Param("dateId") String dateId); /** - * @return java.lang.Integer - * @param userId 用户id + * @param userId 用户id * @param customerId * @param monthId + * @return java.lang.Integer * @author yinzuomei * @description 查询用户在这个月内表决的总次数 * @Date 2020/9/20 21:52 **/ - Integer selectCountUserVote(@Param("userId") String userId, @Param("customerId") String customerId, @Param("monthId")String monthId); + Integer selectCountUserVote(@Param("userId") String userId, @Param("customerId") String customerId, @Param("monthId") String monthId); /** - * @Description 查询 议题表决【党员/群众】 * @param customerId * @param monthId * @param isParty + * @Description 查询 议题表决【党员/群众】 * @author zxc * @date 2020/9/21 9:37 上午 */ - List selectPartyActiveIssueVote(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("isParty") Integer isParty); + List selectPartyActiveIssueVote(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("isParty") Integer isParty); /** - * @return int * @param customerId * @param gridId * @param communityId * @param agencyPath * @param isParty + * @return int * @author yinzuomei * @description 党员参与议事:支持或者反对的次数 * @Date 2020/9/26 18:05 @@ -91,14 +92,25 @@ public interface FactOriginIssueLogDailyDao extends BaseDao + * @author LiuJanJun + * @date 2020/9/27 1:58 下午 + */ + List getVoteCount(@Param("customerId") String customerId, @Param("monthId") String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index ca7a25d340..190353059f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -1,13 +1,14 @@ package com.epmet.dao.issue; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; +import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; +import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; +import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; -import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.entity.issue.IssueEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -29,33 +30,36 @@ public interface StatsIssueDao extends BaseDao { */ List selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date); - /** - * 获取当前日期组织下议题增量 - * @author zhaoqifeng - * @date 2020/6/18 9:55 - * @param customerId - * @param date - * @return java.util.List - */ + /** + * 获取当前日期组织下议题增量 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 9:55 + */ List selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date); - /** - * 已关闭议题统计 - * @author zhaoqifeng - * @date 2020/6/18 14:41 - * @param customerId - * @param date - * @return java.util.List + /** + * 已关闭议题统计 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 14:41 */ List selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); - /** - * 已关闭议题增量 - * @author zhaoqifeng - * @date 2020/6/18 14:41 - * @param customerId - * @param date - * @return java.util.List + /** + * 已关闭议题增量 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 14:41 */ List selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); @@ -66,6 +70,7 @@ public interface StatsIssueDao extends BaseDao { * @Description 根据客户Id查询议题库已转项目的网格项目关系数据 **/ List selectGridProjectList(IssueEntity issueEntity); + /** * 获取当前日期网格下议题统计结果 * @@ -77,87 +82,103 @@ public interface StatsIssueDao extends BaseDao { */ List selectGridIssueTotal(@Param("customerId") String customerId, @Param("date") String date); - /** - * 获取当前日期网格下议题增量 - * @author zhaoqifeng - * @date 2020/6/18 9:55 - * @param customerId - * @param date - * @return java.util.List - */ - List selectGridIssueInc(@Param("customerId") String customerId, @Param("date") String date); - - /** - * 网格已关闭议题统计 - * @author zhaoqifeng - * @date 2020/6/18 14:41 - * @param customerId - * @param date - * @return java.util.List - */ - List selectGridClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); - - /** - * 网格已关闭议题增量 - * @author zhaoqifeng - * @date 2020/6/18 14:41 - * @param customerId - * @param date - * @return java.util.List - */ - List selectGridClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); - - /** - * 查询客户下议题和项目关系 - * @author zhaoqifeng - * @date 2020/6/19 17:34 - * @param customerId - * @return java.util.List + /** + * 获取当前日期网格下议题增量 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 9:55 + */ + List selectGridIssueInc(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 网格已关闭议题统计 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 14:41 + */ + List selectGridClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 网格已关闭议题增量 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 14:41 + */ + List selectGridClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 查询客户下议题和项目关系 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/19 17:34 */ List selectIssueProjectList(@Param("customerId") String customerId); - /** - * 根据ID获取议题信息 - * @author zhaoqifeng - * @date 2020/9/15 16:56 - * @param ids - * @return java.util.List - */ - List selectIssueInfoByIds(@Param("ids") List ids); - - /** - * @Description 查询议题信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/15 2:28 下午 - */ - List selectIssueInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); - - /** - * @Description 查询议题process信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/16 1:48 下午 - */ - List selectIssueProcessInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); - - /** - * @Description 查询议题满意度评价信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/16 1:48 下午 - */ - List selectIssueSatisfactionInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); - - /** - * @Description 查询议题支持反对信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/16 1:48 下午 - */ - List selectIssueVoteInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); + /** + * 根据ID获取议题信息 + * + * @param ids + * @return java.util.List + * @author zhaoqifeng + * @date 2020/9/15 16:56 + */ + List selectIssueInfoByIds(@Param("ids") List ids); + + /** + * @param customerId + * @param dateId + * @Description 查询议题信息 + * @author zxc + * @date 2020/9/15 2:28 下午 + */ + List selectIssueInfo(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @param customerId + * @param dateId + * @Description 查询议题process信息 + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueProcessInfo(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @param customerId + * @param dateId + * @Description 查询议题满意度评价信息 + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueSatisfactionInfo(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @param customerId + * @param dateId + * @Description 查询议题支持反对信息 + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueVoteInfo(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * desc: 根据客户id 获取当前议题的情况 + * + * @param customerId + * @param dateId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 1:22 下午 + */ + List selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index c7ea8e56bb..239ad2d8b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -1,12 +1,13 @@ package com.epmet.service.Issue; -import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; +import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; +import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; +import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; -import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.entity.issue.IssueEntity; import java.util.List; @@ -149,14 +150,26 @@ public interface IssueService { * @author zxc * @date 2020/9/16 1:48 下午 */ - List selectIssueSatisfactionInfo(String customerId,String dateId); - - /** - * @Description 查询议题支持反对信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/16 1:48 下午 - */ - List selectIssueVoteInfo(String customerId,String dateId); + List selectIssueSatisfactionInfo(String customerId, String dateId); + + /** + * @param customerId + * @param dateId + * @Description 查询议题支持反对信息 + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueVoteInfo(String customerId, String dateId); + + /** + * desc: 【月】查询议题支持反对及应表决人数 + * 数据由两部分组成 1:本月内已经关闭的话题的支持和反对数据 来自issue,issue_vote_statistical + * + * @param customerId + * @param monthId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 11:20 上午 + */ + List selectIssueVoteStatis(String customerId, String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 981082f743..e134358618 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -3,13 +3,14 @@ package com.epmet.service.Issue.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.issue.StatsIssueDao; -import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; +import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; +import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; +import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; -import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.entity.issue.IssueEntity; import com.epmet.service.Issue.IssueService; import org.springframework.beans.factory.annotation.Autowired; @@ -127,14 +128,19 @@ public class IssueServiceImpl implements IssueService { } /** - * @Description 查询议题支持反对信息 - * @param customerId - * @param dateId - * @author zxc - * @date 2020/9/16 1:48 下午 - */ - @Override - public List selectIssueVoteInfo(String customerId, String dateId) { - return statsIssueDao.selectIssueVoteInfo(customerId, dateId); - } + * @Description 查询议题支持反对信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + @Override + public List selectIssueVoteInfo(String customerId, String dateId) { + return statsIssueDao.selectIssueVoteInfo(customerId, dateId); + } + + @Override + public List selectIssueVoteStatis(String customerId, String dateId) { + return statsIssueDao.selectIssueVoteStatis(customerId, dateId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index fdaac9d36e..c14364b799 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; @@ -62,14 +63,24 @@ public interface FactOriginGroupMainDailyService extends BaseService originGroupData,List memberList); + boolean insertExtractedData(boolean isFirst, String customerId, String dateId, List originGroupData, List memberList); /** - * @Description 查询党员建组信息 * @param customerId * @param monthId + * @Description 查询党员建组信息 * @author zxc * @date 2020/9/25 9:46 上午 */ - List selectPartyCreateGroupInfo(String customerId,String monthId,List gridIds); + List selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds); + + /** + * desc: 获取客户下每个网格小组内的 去重人数 + * + * @param customerId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 2:24 下午 + */ + List selectDistinctGroupMemberCount(String customerId); } \ 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/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index a6376e27dc..a5de0ab804 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -18,10 +18,13 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; +import java.util.List; + /** - * 议题记录附表 + * 议题记录附表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-23 @@ -29,12 +32,12 @@ import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; public interface FactOriginIssueLogDailyService extends BaseService { /** - * @return int * @param customerId * @param gridId * @param communityId * @param agencyPath * @param isParty + * @return int * @author yinzuomei * @description 党员参与议事:支持或者反对的次数 * @Date 2020/9/26 17:57 @@ -42,12 +45,23 @@ public interface FactOriginIssueLogDailyService extends BaseService + * @author LiuJanJun + * @date 2020/9/27 1:58 下午 + */ + List getVoteCount(String customerId, String monthId); } \ 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/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index 4cc0ebb248..f0b5cd53f0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -18,10 +18,10 @@ package com.epmet.service.evaluationindex.extract.todata.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.NumConstant; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; @@ -108,11 +108,16 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl selectPartyCreateGroupInfo(String customerId, String monthId,List gridIds) { - if (!CollectionUtils.isEmpty(gridIds)){ + public List selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds) { + if (!CollectionUtils.isEmpty(gridIds)) { return baseDao.selectPartyCreateGroupInfo(customerId, monthId, gridIds); } return new ArrayList<>(); } + @Override + public List selectDistinctGroupMemberCount(String customerId) { + return baseDao.selectDistinctGroupMemberCount(customerId); + } + } \ 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/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index 66df6ec87c..e86a41a309 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; +import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; @@ -31,8 +32,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** - * 议题记录附表 + * 议题记录附表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-23 @@ -86,4 +89,8 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl getVoteCount(String customerId, String monthId) { + return baseDao.getVoteCount(customerId, monthId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index bb94830ba1..2f2d5f1e4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -7,11 +7,15 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.OrgTypeConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; import com.epmet.dto.extract.result.GridUserCountResultDTO; +import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimGridEntity; import com.epmet.entity.stats.FactIssueGridMonthlyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimGridService; @@ -48,6 +52,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { private FactIssueGridMonthlyService factIssueGridMonthlyService; @Autowired private FactRegUserGridMonthlyService factRegUserGridMonthlyService; + @Autowired + private FactOriginIssueLogDailyService factOriginIssueLogDailyService; + @Autowired + private FactOriginGroupMainDailyService factOriginGroupMainDailyService; /** @@ -55,7 +63,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { * target:screen_user_join * 总参与:统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数 * 百人人均议题:统计周期内总的议题数/(注册用户数/100) - * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 + * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 来源 获取issue_vote_statistical_daily中 monthId的数据 + *

+ *

+ *

* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 * * @return java.lang.Boolean @@ -101,16 +112,42 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { GridUserCountResultDTO user = userCountMap.get(gridId); //百人人均议题:统计周期内总的议题数/(注册用户数/100) BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getUserCount()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); - // 需要修改字段类型 entity.setAvgIssue(avgIssueCount); - - //百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 + }); - entity.setAvgJoin(new BigDecimal(0)); - }); + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId()); + Map gridMemberCount = new HashMap<>(); + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个网格的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(memberCountList)) { + log.error("抽取【公众参与-人均议题】,获取应表决人数为空"); + return; + } + gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getGridId, o -> o.getMemberCount())); + } + //百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 + //遍历实际参与人数 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getGridId)); + for (Map.Entry> entry : voteMap.entrySet()) { + String gridId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + List issueList = entry.getValue(); + BigDecimal bigDecimal = new BigDecimal(0); + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); + for (IssueVoteUserCountResultDTO vote : issueList) { + Integer memberCount = gridMemberCount.get(gridId); + if (memberCount == null) { + memberCount = 0; + } + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + } + entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); + } } private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index a6c9b62bee..2680ca1605 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -264,4 +264,19 @@ ) GROUP BY GRID_ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 85c927d5c3..1d549be8cc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -138,4 +138,20 @@ and m.PIDS LIKE CONCAT(#{pids},'%') + + \ No newline at end of file From 38a3fbd53d83368940b211e36fc48937dd0b50fd Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 27 Sep 2020 15:44:03 +0800 Subject: [PATCH 05/21] =?UTF-8?q?issue=E7=9A=84pids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/todata/impl/IssueExtractServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index a222e22cbb..804c884998 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -128,7 +128,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(pid -> { if (r.getAgencyId().equals(pid.getAgencyId())){ r.setPid(pid.getPid()); - r.setPids(pid.getPids().concat(":").concat(pid.getPid())); + r.setPids(pid.getPids().concat(":").concat(r.getAgencyId())); } }); }); @@ -227,7 +227,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(agency -> { if (r.getAgencyId().equals(agency.getAgencyId())){ r.setPid(agency.getPid()); - r.setPids(agency.getPids()); + r.setPids(agency.getPids().concat(":").concat(r.getAgencyId())); } }); }); From 787af996303d12188e2ee6515f4666095f79e8b8 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 27 Sep 2020 15:53:58 +0800 Subject: [PATCH 06/21] =?UTF-8?q?screen=5Fpioneer=5Fdata=E5=85=9A=E5=91=98?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=AE=AE=E4=BA=8B=E6=8F=90=E4=BA=A4=20V0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/DemoController.java | 8 +++++++- .../impl/FactOriginIssueLogDailyServiceImpl.java | 11 +++++++++-- .../toscreen/impl/PioneerDataExtractServiceImpl.java | 7 ++++--- .../impl/ScreenPublicPartiTotalDataServiceImpl.java | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 8b0dc2156a..708bc70d60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -673,7 +673,8 @@ public class DemoController { @Autowired private PioneerDataExtractService pioneerDataExtractService; - + @Autowired + private PublicPartiTotalDataExtractService publicPartiTotalDataExtractService; @PostMapping("insertScreenPioneerData") public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId) { if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(dateId)) { @@ -692,6 +693,11 @@ public class DemoController { return new Result(); } + @PostMapping("extractPublicPartiTotalData") + public Result extractPublicPartiTotalData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId){ + publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId,dateId); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index e86a41a309..923ac3f2ff 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.dto.stats.DimAgencyDTO; @@ -73,7 +74,7 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl gridList = screenPioneerDataService.initPioneerDataList(customerId, "grid"); + List gridList = screenPioneerDataService.initPioneerDataList(customerId, OrgTypeConstant.GRID); if (CollectionUtils.isEmpty(gridList)) { return; } @@ -140,7 +141,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService @Override public void extractCommunityPioneerData(String customerId, String dateId) { //查询客户下所有的社区,初始数据值为0 - List communityList = screenPioneerDataService.initPioneerDataList(customerId, "community"); + List communityList = screenPioneerDataService.initPioneerDataList(customerId, OrgTypeConstant.COMMUNITY); if (CollectionUtils.isEmpty(communityList)) { return; } @@ -209,7 +210,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService @Override public void extractExceptCommunityPioneerData(String customerId, String dateId) { //查询客户下所有的组织(社区除外),初始数据值为0 - List agencyList = screenPioneerDataService.initPioneerDataList(customerId, "agency"); + List agencyList = screenPioneerDataService.initPioneerDataList(customerId, OrgTypeConstant.AGENCY); if (CollectionUtils.isEmpty(agencyList)) { return; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java index fdc231a5d2..859941d9ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java @@ -18,8 +18,10 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.screen.ScreenPublicPartiTotalDataDao; import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; @@ -49,6 +51,7 @@ public class ScreenPublicPartiTotalDataServiceImpl extends BaseServiceImpl entityList) { From 2871ae86221f3664521fbdeee90dda489eb02b6c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 27 Sep 2020 16:06:26 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9C=88=E5=BA=A6?= =?UTF-8?q?=E6=8C=87=E6=95=B0=E6=8E=A5=E5=8F=A3bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/evaluationindex/screen/impl/IndexServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index 93276c8725..fe09c575db 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -270,6 +270,9 @@ public class IndexServiceImpl implements IndexService { //screen_index_data_monthly 根据组织id和月份获取月度指标得分 //1.根据组织或网格Id以及月份Id查询各项月度指数得分 IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO); + if (null == resultDTO) { + return resultDTO; + } //2.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比 NumberFormat nf = NumberFormat.getPercentInstance(); From 81065c3b7772055124c40babba354d160b99cce9 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 27 Sep 2020 16:10:24 +0800 Subject: [PATCH 08/21] =?UTF-8?q?screen=5Fpioneer=5Fdata=E5=85=9A=E5=91=98?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E8=AE=AE=E4=BA=8B=E6=8F=90=E4=BA=A4=20V0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/DimObjectStatusConstant.java | 8 ++++++++ .../dataToIndex/impl/CalCpcIndexServiceImpl.java | 7 +++---- .../impl/PioneerDataExtractServiceImpl.java | 11 ++++++----- .../PublicPartiTotalDataExtractServiceImpl.java | 13 +++---------- .../screen/impl/ScreenPioneerDataServiceImpl.java | 7 ++++--- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java index 5ceae84d44..97342260a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java @@ -7,4 +7,12 @@ package com.epmet.constant; * @date 2020/9/16 10:14 */ public interface DimObjectStatusConstant { + /** + * 已解决 + */ + String RESOLVED="resolved"; + /** + * 无需解决 + */ + String UNRESOLVED="unresolved"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java index 41c21e6b68..d76391ece8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java @@ -2,7 +2,6 @@ package com.epmet.service.evaluationindex.extract.dataToIndex.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.dto.indexcal.CpcScoreResultDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService; import com.epmet.service.evaluationindex.extract.todata.*; @@ -57,7 +56,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { //1、构造初始值 List indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId); if (CollectionUtils.isEmpty(indexPartyAblityCpcList)) { - log.info("dim_customer_partymember do not any records"); + log.info("dim_customer_partymember do not any records customerId="+customerId); return; } String quarterId= DateUtils.getQuarterId(monthId); @@ -75,11 +74,11 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { //可以先查询出每个党员的 自建群 Map> userCreatedGroups = queryUserCreatedGroups(customerId, indexPartyAblityCpcList); - //6、党员自建群群众人数 (todo 和monthId无关??) + //6、党员自建群群众人数 :和评价周期无关 Map groupUserCountMap = calgroupUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); //7、党员自建群活跃群众人数 Map groupActiveUserCountMap = calGroupActiveUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); - //8、党员自建群活跃度——话题数 (todo 校验sql正确性) + //8、党员自建群活跃度——话题数:从话题表中统计党员自建群i的话题总数;对所有自建群话题数累加。 Map groupTopicCountMap = calGroupTopicCount(customerId, monthId); //9、自建群活跃度——议题转项目率 Map topicToIssueRatioMap = caltopicToIssueRatio(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 2062a57668..10f16a3273 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.constant.DimObjectStatusConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity; @@ -107,7 +108,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 - entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, "resolved")); + entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED)); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { @@ -194,7 +195,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 - entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, "resolved")); + entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, DimObjectStatusConstant.RESOLVED)); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { @@ -203,7 +204,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); - screenPioneerDataService.delAndSavePioneerData(customerId, "agency", IndexCalConstant.DELETE_SIZE, communityList); + screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, communityList); } @@ -267,7 +268,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 - entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), "resolved")); + entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), DimObjectStatusConstant.RESOLVED)); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { @@ -276,7 +277,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); - screenPioneerDataService.delAndSavePioneerData(customerId, "agency", IndexCalConstant.DELETE_SIZE, agencyList); + screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, agencyList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java index a228e13f8b..23d433b8b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; @@ -41,21 +42,13 @@ public class PublicPartiTotalDataExtractServiceImpl implements PublicPartiTotalD public void extractPublicPartiTotalData(String customerId, String dateId) { List userTotalDataEntityList = screenUserTotalDataService.selectList(customerId); if (CollectionUtils.isEmpty(userTotalDataEntityList)) { - log.warn("screen_user_total_data dosen't have any record "); + log.warn("screen_user_total_data dosen't have any record customerId="+customerId); return; } List list = new ArrayList<>(); for (ScreenUserTotalDataEntity totalData : userTotalDataEntityList) { - ScreenPublicPartiTotalDataEntity entity = new ScreenPublicPartiTotalDataEntity(); - entity.setCustomerId(customerId); - entity.setOrgType(totalData.getOrgType()); - entity.setOrgId(totalData.getOrgId()); - entity.setParentId(totalData.getParentId()); - entity.setOrgName(totalData.getOrgName()); + ScreenPublicPartiTotalDataEntity entity = ConvertUtils.sourceToTarget(totalData,ScreenPublicPartiTotalDataEntity.class); entity.setDataEndTime(dateId); - entity.setTopicTotal(totalData.getTopicTotal()); - entity.setIssueTotal(totalData.getIssueTotal()); - entity.setProjectTotal(totalData.getProjectTotal()); entity.setRegUserTotal(totalData.getUserTotal()); //参与人数参与人数: 议题的表决行为的用户数去重的累计值 int joinUserTotal=factOriginIssueLogDailyService.queryJoinUserTotal(customerId,totalData.getOrgType(),totalData.getOrgId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java index 0ae80e0b0c..ff49082598 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; +import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenPioneerDataDao; import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity; import com.epmet.service.evaluationindex.screen.ScreenPioneerDataService; @@ -58,13 +59,13 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl initPioneerDataList(String customerId, String orgType) { List list = new ArrayList<>(); - if ("grid".equals(orgType)) { + if (OrgTypeConstant.GRID.equals(orgType)) { //按网格构造 list = baseDao.initGridPioneerDataList(customerId); - } else if ("community".equals(orgType)) { + } else if (OrgTypeConstant.COMMUNITY.equals(orgType)) { //按社构造 list = baseDao.initCommunityPioneerDataList(customerId); - }else if("agency".equals(orgType)){ + }else if(OrgTypeConstant.AGENCY.equals(orgType)){ list = baseDao.initExceptCommunityPioneerDataList(customerId); } return list; From dd24cbc19520ab7c08c2e46d70a566935da8b2a5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 27 Sep 2020 16:15:57 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E5=85=9A=E5=91=98=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E4=B8=AD=E7=9A=84=20=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=EF=BC=9A=20=E8=AE=AE=E9=A2=98=E7=9A=84=E8=A1=A8=E5=86=B3?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=AC=A1=E6=95=B0=E6=80=BB=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PioneerDataExtractServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 10f16a3273..d33dba39fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -62,6 +62,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService gridList.forEach(entity -> { entity.setDataEndTime(dateId); String gridId = entity.getOrgId(); + //何为参与: 议题的表决行为次数总计 //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,gridId,null,null,NumConstant.ONE_STR)); if(entity.getIssueTotal()==0){ From c49c4ef6a1b2ecbadffc0707577fdfed3e2cd0f5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 27 Sep 2020 16:35:32 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E6=94=B9=E7=94=A8OrgTypeConstant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PioneerDataExtractServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index d33dba39fd..e71227623c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -118,7 +118,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); - screenPioneerDataService.delAndSavePioneerData(customerId, "grid", IndexCalConstant.DELETE_SIZE, gridList); + screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.GRID, IndexCalConstant.DELETE_SIZE, gridList); } /** From 341ed21e18face1815e179384ae4f0ce0654a68f Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 17:14:39 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/GridGroupUserCountResultDTO.java | 2 +- .../result/GridUserCountResultDTO.java | 5 + .../result/IssueVoteUserCountResultDTO.java | 3 +- .../com/epmet/constant/ProjectConstant.java | 2 + .../ScreenExtractDailyController.java | 12 ++ .../extract/FactOriginGroupMainDailyDao.java | 3 +- .../extract/FactOriginIssueLogDailyDao.java | 14 +- .../dao/stats/FactIssueAgencyMonthlyDao.java | 30 +++- .../user/FactRegUserAgencyMonthlyDao.java | 5 +- .../FactOriginGroupMainDailyService.java | 3 +- .../FactOriginIssueLogDailyService.java | 3 +- .../FactOriginGroupMainDailyServiceImpl.java | 4 +- .../FactOriginIssueLogDailyServiceImpl.java | 4 +- .../toscreen/ScreenExtractService.java | 8 + .../impl/PublicPartExtractServiceImpl.java | 92 ++++++++-- .../impl/ScreenExtractServiceImpl.java | 56 ++++++- .../screen/ScreenUserJoinService.java | 13 ++ .../impl/ScreenUserJoinServiceImpl.java | 157 ++++++++++++++++++ .../stats/FactIssueAgencyMonthlyService.java | 16 +- .../stats/FactIssueGridMonthlyService.java | 2 +- .../FactIssueAgencyMonthlyServiceImpl.java | 5 + .../impl/FactIssueGridMonthlyServiceImpl.java | 2 +- .../user/FactRegUserAgencyMonthlyService.java | 13 +- .../FactRegUserAgencyMonthlyServiceImpl.java | 9 +- .../extract/FactOriginGroupMainDailyDao.xml | 6 +- .../extract/FactOriginIssueLogDailyDao.xml | 35 ++-- .../stats/FactIssueAgencyMonthlyDao.xml | 9 + .../user/FactRegUserAgencyMonthlyDao.xml | 13 ++ .../stats/user/FactRegUserGridMonthlyDao.xml | 3 +- 29 files changed, 454 insertions(+), 75 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java index 72723e1987..c3275dc075 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridGroupUserCountResultDTO.java @@ -20,7 +20,7 @@ public class GridGroupUserCountResultDTO implements Serializable { */ private String customerId; - private String gridId; + private String orgId; private Integer memberCount; /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java index 0203708448..efe3b0747e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java @@ -28,4 +28,9 @@ public class GridUserCountResultDTO implements Serializable { * 网格ID */ private String gridId; + + /** + * 用户总数 + */ + private Integer regTotal; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java index 405ab7b3a8..e26bd0ec2a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueVoteUserCountResultDTO.java @@ -15,8 +15,7 @@ public class IssueVoteUserCountResultDTO implements Serializable { private static final long serialVersionUID = -4729061928990808187L; - private String gridId; - private String issueId; + private String orgId; private Integer voteCount; private Integer issueCount; /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index ff2c4558c5..eac79f016a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -62,4 +62,6 @@ public interface ProjectConstant { * 下级 */ String XIA_JI = "xiaji"; + String GRID_ID = "GRID_ID"; + String AGENCY_ID = "AGENCY_ID"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java index 34e8c7ccde..4d05009ec8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java @@ -32,4 +32,16 @@ public class ScreenExtractDailyController { return new Result(); } + /** + * @param extractOriginFormDTO + * @Description 抽取数据到大屏【月】 + * @author zxc + * @date 2020/9/24 10:15 上午 + */ + @PostMapping("extractmonthlyyall") + public Result screenExtractMonthly(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { + screenExtractService.extractDailyAll(extractOriginFormDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index 5107262311..f1ad597f68 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -153,9 +153,10 @@ public interface FactOriginGroupMainDailyDao extends BaseDao * @author LiuJanJun * @date 2020/9/27 2:31 下午 */ - List selectDistinctGroupMemberCount(@Param("customerId") String customerId); + List selectDistinctGroupMemberCount(@Param("customerId") String customerId, @Param("groupField") String groupField); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 793926e513..9dd9089d97 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -85,11 +85,11 @@ public interface FactOriginIssueLogDailyDao extends BaseDao * @author LiuJanJun * @date 2020/9/27 1:58 下午 */ - List getVoteCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + List getVoteCount(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("groupField") String groupField); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java index 6f9933bf1a..1e686cc690 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java @@ -42,14 +42,26 @@ public interface FactIssueAgencyMonthlyDao extends BaseDao */ List selectAgencyMonthlyInc(@Param("customerId") String customerId, @Param("monthId") String monthId); - /** - * 删除 - * @author zhaoqifeng - * @date 2020/6/23 14:02 - * @param customerId - * @param monthId - * @return void - */ - void deleteByCustomerId(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * 删除 + * + * @param customerId + * @param monthId + * @return void + * @author zhaoqifeng + * @date 2020/6/23 14:02 + */ + void deleteByCustomerId(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * desc: 获取各机关某月议题增量和议题总数 + * + * @param customerId + * @param monthId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 3:33 下午 + */ + List getIssueIncCountAndTotalByMonthId(String customerId, String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java index e59f48e8c5..bf0b951134 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.GridUserCountResultDTO; import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; import com.epmet.entity.stats.user.FactRegUserAgencyMonthlyEntity; import org.apache.ibatis.annotations.Mapper; @@ -36,5 +37,7 @@ public interface FactRegUserAgencyMonthlyDao extends BaseDao list); - void deleteByParams(@Param("monthId")String monthId,@Param("customerId")String customerId); + void deleteByParams(@Param("monthId") String monthId, @Param("customerId") String customerId); + + List selectAgencyUserCount(@Param("customerId") String customerId, @Param("monthId") String monthId); } \ 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/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index c14364b799..b603d56d02 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -78,9 +78,10 @@ public interface FactOriginGroupMainDailyService extends BaseService * @author LiuJanJun * @date 2020/9/27 2:24 下午 */ - List selectDistinctGroupMemberCount(String customerId); + List selectDistinctGroupMemberCount(String customerId, String groupField); } \ 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/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index a5de0ab804..591ff23f55 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -59,9 +59,10 @@ public interface FactOriginIssueLogDailyService extends BaseService * @author LiuJanJun * @date 2020/9/27 1:58 下午 */ - List getVoteCount(String customerId, String monthId); + List getVoteCount(String customerId, String monthId, String groupField); } \ 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/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index f0b5cd53f0..b19ea0df4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -116,8 +116,8 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl selectDistinctGroupMemberCount(String customerId) { - return baseDao.selectDistinctGroupMemberCount(customerId); + public List selectDistinctGroupMemberCount(String customerId, String groupField) { + return baseDao.selectDistinctGroupMemberCount(customerId, groupField); } } \ 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/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index 923ac3f2ff..b41f762bf4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -97,7 +97,7 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl getVoteCount(String customerId, String monthId) { - return baseDao.getVoteCount(customerId, monthId); + public List getVoteCount(String customerId, String monthId, String groupField) { + return baseDao.getVoteCount(customerId, monthId, groupField); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java index f61b933bf4..7b5ee20155 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java @@ -16,4 +16,12 @@ public interface ScreenExtractService { */ void extractDailyAll(ExtractOriginFormDTO extractOriginFormDTO); + /** + * @param extractOriginFormDTO + * @Description 抽取数据到大屏【月】 + * @author zxc + * @date 2020/9/24 10:15 上午 + */ + void extractMonthlyAll(ExtractOriginFormDTO extractOriginFormDTO); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 2f2d5f1e4a..68f4886f8f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.OrgTypeConstant; +import com.epmet.constant.ProjectConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; import com.epmet.dto.extract.result.GridUserCountResultDTO; @@ -13,25 +14,28 @@ import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimGridEntity; +import com.epmet.entity.stats.FactIssueAgencyMonthlyEntity; import com.epmet.entity.stats.FactIssueGridMonthlyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService; +import com.epmet.service.evaluationindex.screen.ScreenUserJoinService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimGridService; +import com.epmet.service.stats.FactIssueAgencyMonthlyService; import com.epmet.service.stats.FactIssueGridMonthlyService; +import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService; import com.epmet.service.stats.user.FactRegUserGridMonthlyService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -53,9 +57,15 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { @Autowired private FactRegUserGridMonthlyService factRegUserGridMonthlyService; @Autowired + private FactIssueAgencyMonthlyService factIssueAgencyMonthlyService; + @Autowired + private FactRegUserAgencyMonthlyService factRegUserAgencyMonthlyService; + @Autowired private FactOriginIssueLogDailyService factOriginIssueLogDailyService; @Autowired private FactOriginGroupMainDailyService factOriginGroupMainDailyService; + @Autowired + private ScreenUserJoinService screenUserJoinService; /** @@ -64,9 +74,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { * 总参与:统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数 * 百人人均议题:统计周期内总的议题数/(注册用户数/100) * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 来源 获取issue_vote_statistical_daily中 monthId的数据 - *

- *

- *

+ * * 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 * * @return java.lang.Boolean @@ -94,7 +102,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { Map insertMap = new HashMap<>(); orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); //获取议题月份增量 - List issueTotal = factIssueGridMonthlyService.getIssueCount(formDTO.getCustomerId(), formDTO.getMonthId()); + List issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); if (CollectionUtils.isEmpty(issueTotal)) { log.error("抽取【公众参与-人均议题】,获取议题增量为空"); return; @@ -111,28 +119,28 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(gridId); //百人人均议题:统计周期内总的议题数/(注册用户数/100) - BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getUserCount()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); entity.setAvgIssue(avgIssueCount); }); //获取该月 表决的人数 - List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId()); + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.GRID_ID); Map gridMemberCount = new HashMap<>(); if (!CollectionUtils.isEmpty(issueTotal)) { //获取每个网格的应表决人数 - List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId()); + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); if (CollectionUtils.isEmpty(memberCountList)) { log.error("抽取【公众参与-人均议题】,获取应表决人数为空"); return; } - gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getGridId, o -> o.getMemberCount())); + gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); } //百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 //遍历实际参与人数 - Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getGridId)); + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); for (Map.Entry> entry : voteMap.entrySet()) { String gridId = entry.getKey(); ScreenUserJoinEntity entity = insertMap.get(gridId); @@ -148,6 +156,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); } private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { @@ -158,10 +167,63 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } //构建组织数据 Map insertMap = new HashMap<>(); - orgList.forEach(org -> { - buildUserJoinEntity(formDTO, org, insertMap); + orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + List issueTotal = factIssueAgencyMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + + List userCountList = factRegUserAgencyMonthlyService.selectAgencyUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(issueTotal)) { + log.error("抽取【公众参与-人均议题】,获取注册用户数为空"); + return; + } + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o)); + Set agencyIdSet = new HashSet<>(); + issueTotal.forEach(issue -> { + String agencyId = issue.getAgencyId(); + agencyIdSet.add(agencyId); + ScreenUserJoinEntity entity = insertMap.get(agencyId); + entity.setJoinTotal(issue.getIssueIncr()); + GridUserCountResultDTO user = userCountMap.get(agencyId); + //百人人均议题:统计周期内总的议题数/(注册用户数/100) + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); + entity.setAvgIssue(avgIssueCount); + }); + + List> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); + partition.forEach(list -> { + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); + Map orgMemberCount = new HashMap<>(); + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个网格的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + log.error("抽取【公众参与-人均议题】,获取应表决人数为空"); + return; + } + orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + + //百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 + + //遍历实际参与人数 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + for (Map.Entry> entry : voteMap.entrySet()) { + String orgId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(orgId); + List issueList = entry.getValue(); + BigDecimal bigDecimal = new BigDecimal(0); + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); + for (IssueVoteUserCountResultDTO vote : issueList) { + Integer memberCount = orgMemberCount.get(orgId); + if (memberCount == null) { + memberCount = 0; + } + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + } + entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); + } }); - List issueTotal = factIssueGridMonthlyService.getIssueCount(formDTO.getCustomerId(), formDTO.getMonthId()); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); } private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map result) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 9c8b73e49e..7853b0c69b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -3,8 +3,10 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; import com.epmet.service.evaluationindex.extract.toscreen.PioneerDataExtractService; +import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; @@ -31,6 +33,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private PartyBaseInfoService partyBaseInfoService; @Autowired private PioneerDataExtractService pioneerDataExtractService; + @Autowired + private PublicPartExtractService publicPartExtractService; /** * @param extractOriginFormDTO @@ -66,17 +70,59 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } + @Override + public void extractMonthlyAll(ExtractOriginFormDTO formDTO) { + + List customerIds = new ArrayList<>(); + if (StringUtils.isNotBlank(formDTO.getCustomerId())) { + customerIds.add(formDTO.getCustomerId()); + } else { + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize); + } + if (!CollectionUtils.isEmpty(customerIds)) { + customerIds.forEach(customerId -> { + if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { + List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); + daysBetween.forEach(dateId -> { + extractMonthly(customerId, dateId); + }); + } else if (StringUtils.isNotBlank(formDTO.getDateId())) { + extractMonthly(customerId, formDTO.getDateId()); + } else { + String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); + extractMonthly(customerId, dateId); + } + }); + } + + } + /** - * @Description 按天计算 * @param customerId * @param dateId + * @Description 按天计算 * @author zxc * @date 2020/9/24 10:16 上午 */ - public void extractDaily(String customerId,String dateId){ + public void extractDaily(String customerId, String dateId) { // partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId); - pioneerDataExtractService.extractGridPioneerData(customerId,dateId); - pioneerDataExtractService.extractCommunityPioneerData(customerId,dateId); - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId,dateId); + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } + + /** + * @Description 按月计算 + * @author zxc + * @date 2020/9/24 10:16 上午 + */ + public void extractMonthly(String customerId, String monthId) { + ExtractScreenFormDTO formDTO = new ExtractScreenFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setMonthId(monthId); + + publicPartExtractService.extractTotalDataMonthly(formDTO); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java index 902aea5d43..0a42c758a4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java @@ -19,8 +19,11 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; +import java.util.List; + /** * 基层治理-公众参与 * @@ -28,4 +31,14 @@ import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; * @since v1.0.0 2020-09-22 */ public interface ScreenUserJoinService extends BaseService { + /** + * desc: 删除并插入某月的数据 + * + * @param formDTO + * @param list + * @return java.lang.Boolean + * @author LiuJanJun + * @date 2020/9/27 4:40 下午 + */ + Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java index f2bbb8b628..c6ca536993 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java @@ -18,11 +18,27 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.CompareConstant; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenUserJoinDao; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.service.evaluationindex.screen.ScreenUserJoinService; +import com.epmet.util.DimIdGenerator; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; /** * 基层治理-公众参与 @@ -30,8 +46,149 @@ import org.springframework.stereotype.Service; * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-22 */ +@Slf4j @Service public class ScreenUserJoinServiceImpl extends BaseServiceImpl implements ScreenUserJoinService { + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + @Transactional(rollbackFor = Exception.class) + public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list) { + if (formDTO == null || StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId()) || CollectionUtils.isEmpty(list)) { + log.error("deleteAndInsertBatch param is error"); + return false; + } + int deleteNum; + do { + deleteNum = baseDao.deleteUserJoin(formDTO.getCustomerId(), formDTO.getMonthId()); + } while (deleteNum != NumConstant.ZERO); + + + String[] orgIds = new String[list.size()]; + for (int i = NumConstant.ZERO; i < list.size(); i++) { + orgIds[i] = list.get(i).getOrgId(); + } + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.addDateMonths(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMM), -1)); + // 获取上个月的基本数据 + List lastMonthJoinList = baseDao.selectLastMonthScreenUserJoinList(formDTO.getCustomerId(), + dimIdBean.getYearId(), + dimIdBean.getMonthId(), + orgIds); + + // 定义本月待添加数据的集合 + List curMonthJoinEntityList = new ArrayList<>(); + // 增加率计算 + if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { + // 存在上个月的数据 (本月-上月)/上月 *100 + for (int i = NumConstant.ZERO; i < list.size(); i++) { + for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { + if (list.get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) { + ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(list.get(i), ScreenUserJoinEntity.class); + entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), list.get(j).getJoinTotal())); + entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), list.get(j).getJoinTotal())); + entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgIssue(), list.get(j).getAvgIssue())); + entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgIssue(), list.get(j).getAvgIssue())); + entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgJoin(), list.get(j).getAvgJoin())); + entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgJoin(), list.get(j).getAvgJoin())); + curMonthJoinEntityList.add(entity); + } + } + } + } else { + // 计算增长率后的 待新增数据 + BigDecimal zero = new BigDecimal(NumConstant.ZERO); + // 不存在上个月的数据 + for (int i = NumConstant.ZERO; i < list.size(); i++) { + ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(list.get(i), ScreenUserJoinEntity.class); + entity.setJoinTotalUpRate(zero); + entity.setJoinTotalUpFlag(""); + entity.setAvgIssueUpRate(zero); + entity.setAvgIssueUpFlag(""); + entity.setAgvgJoinUpRate(zero); + entity.setAgvgJoinUpFlag(""); + curMonthJoinEntityList.add(entity); + } + } + + this.insertBatch(list, NumConstant.ONE_HUNDRED); + return true; + } + + + /** + * 计算 本月数值 相较于 上月数值,的增长率 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.math.BigDecimal + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private BigDecimal calculateGrowthRateNumber(Integer old, Integer now) { + if (NumConstant.ZERO == old) { + return new BigDecimal(now * NumConstant.ONE_HUNDRED); + } + BigDecimal bignum1 = new BigDecimal((now - old) * NumConstant.ONE_HUNDRED); + BigDecimal bignum2 = bignum1.divide(new BigDecimal(old), 2, BigDecimal.ROUND_HALF_UP); + return bignum2; + } + + /** + * 计算 本月数值 相较于 上月数值,的增长率 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.math.BigDecimal + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private BigDecimal calculateGrowthRateNumber(BigDecimal old, BigDecimal now) { + BigDecimal oneHundred = new BigDecimal(NumConstant.ONE_HUNDRED); + if (old.compareTo(new BigDecimal(NumConstant.ZERO)) == NumConstant.ZERO) { + return now.multiply(oneHundred); + } + BigDecimal bignum1 = now.subtract(old).multiply(oneHundred); + BigDecimal bignum2 = bignum1.divide(old, 2, BigDecimal.ROUND_HALF_UP); + return bignum2; + } + + + /** + * 计算 本月数值 相较于 上月数值,的增长率, 得出标识 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.util.String + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private String calculateGrowthRateFlag(Integer old, Integer now) { + if (old > now) { + return CompareConstant.DECR_STR; + } else if (old < now) { + return CompareConstant.INCR_STR; + } else { + return CompareConstant.EQ_STR; + } + } + + /** + * 计算 本月数值 相较于 上月数值,的增长率, 得出标识 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.util.String + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private String calculateGrowthRateFlag(BigDecimal old, BigDecimal now) { + if (old.compareTo(now) == 1) { + return CompareConstant.DECR_STR; + } else if (old.compareTo(now) == -1) { + return CompareConstant.INCR_STR; + } else { + return CompareConstant.EQ_STR; + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java index b388e8ee58..944f38884b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java @@ -115,10 +115,22 @@ public interface FactIssueAgencyMonthlyService extends BaseService list); + + /** + * desc: 获取某月议题总数 + * + * @param customerId + * @param monthId + * @return java.util.List + * @author LiuJanJun + * @date 2020/9/27 3:30 下午 + */ + List getIssueIncCountAndTotalByMonthId(String customerId, String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java index 736a6e348c..494823db73 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java @@ -79,5 +79,5 @@ public interface FactIssueGridMonthlyService extends BaseService getIssueCount(String customerId, String monthId); + List getIssueIncCountAndTotalByMonthId(String customerId, String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java index 2c3b7d46af..915bee4837 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java @@ -117,4 +117,9 @@ public class FactIssueAgencyMonthlyServiceImpl extends BaseServiceImpl getIssueIncCountAndTotalByMonthId(String customerId, String monthId) { + return baseDao.getIssueIncCountAndTotalByMonthId(customerId, monthId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java index c002e0e3ca..23ade86942 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java @@ -74,7 +74,7 @@ public class FactIssueGridMonthlyServiceImpl extends BaseServiceImpl getIssueCount(String customerId, String monthId) { + public List getIssueIncCountAndTotalByMonthId(String customerId, String monthId) { return baseDao.getIssueCount(customerId, monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java index 6f5f7c4963..bdce57807a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java @@ -19,10 +19,10 @@ package com.epmet.service.stats.user; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.extract.result.GridUserCountResultDTO; import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; import com.epmet.entity.stats.user.FactRegUserAgencyMonthlyEntity; - import java.util.List; import java.util.Map; @@ -93,4 +93,15 @@ public interface FactRegUserAgencyMonthlyService extends BaseService + * @author LiuJanJun + * @date 2020/9/27 3:45 下午 + */ + List selectAgencyUserCount(String customerId, String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java index 55925a2b81..315609b3bb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java @@ -20,15 +20,15 @@ package com.epmet.service.stats.user.impl; 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.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.user.FactRegUserAgencyMonthlyDao; +import com.epmet.dto.extract.result.GridUserCountResultDTO; import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; import com.epmet.entity.stats.user.FactRegUserAgencyMonthlyEntity; import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -99,4 +99,9 @@ public class FactRegUserAgencyMonthlyServiceImpl extends BaseServiceImpl selectAgencyUserCount(String customerId, String monthId) { + return baseDao.selectAgencyUserCount(customerId, monthId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 2680ca1605..8b326f3aa3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -268,8 +268,8 @@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 1d549be8cc..d006bce552 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -95,6 +95,23 @@ + + + + - - - - \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml index 45f53d10cc..2aab89ada4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml @@ -71,4 +71,13 @@ da.ID + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml index aa8548ff1c..d81d385479 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml @@ -102,4 +102,17 @@ + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml index 42e736c90c..c0efb0dc5e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml @@ -111,7 +111,8 @@ SELECT REG_INCR, PARTYMEMBER_INCR, - GRID_ID + GRID_ID, + REG_TOTAL FROM fact_reg_user_grid_monthly WHERE From 98d1a6d49c66e235cab973cbc836cdc82fa6deba Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 17:32:30 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/extract/form/ExtractScreenFormDTO.java | 4 ++++ .../controller/ScreenExtractDailyController.java | 7 ++++--- .../extract/toscreen/ScreenExtractService.java | 5 +++-- .../impl/PublicPartExtractServiceImpl.java | 10 +++++++--- .../toscreen/impl/ScreenExtractServiceImpl.java | 14 +++++++------- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java index 4bcd4fce65..c4cff4cf5b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java @@ -17,5 +17,9 @@ public class ExtractScreenFormDTO implements Serializable { private String customerId; private String monthId; private String dateId; + private String startMonth; + private String endMonth; + private String startDate; + private String endDate; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java index 4d05009ec8..c83a07427d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -33,14 +34,14 @@ public class ScreenExtractDailyController { } /** - * @param extractOriginFormDTO + * @param formDTO * @Description 抽取数据到大屏【月】 * @author zxc * @date 2020/9/24 10:15 上午 */ @PostMapping("extractmonthlyyall") - public Result screenExtractMonthly(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { - screenExtractService.extractDailyAll(extractOriginFormDTO); + public Result screenExtractMonthly(@RequestBody ExtractScreenFormDTO formDTO) { + screenExtractService.extractMonthlyAll(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java index 7b5ee20155..eefe383408 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.extract.toscreen; import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.extract.form.ExtractScreenFormDTO; /** * @Author zxc @@ -17,11 +18,11 @@ public interface ScreenExtractService { void extractDailyAll(ExtractOriginFormDTO extractOriginFormDTO); /** - * @param extractOriginFormDTO + * @param formDTO * @Description 抽取数据到大屏【月】 * @author zxc * @date 2020/9/24 10:15 上午 */ - void extractMonthlyAll(ExtractOriginFormDTO extractOriginFormDTO); + void extractMonthlyAll(ExtractScreenFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 68f4886f8f..3146e15a43 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -119,8 +119,12 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(gridId); //百人人均议题:统计周期内总的议题数/(注册用户数/100) - BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); - entity.setAvgIssue(avgIssueCount); + log.debug("issue:{}", JSON.toJSONString(issue)); + log.debug("user:{}", JSON.toJSONString(user)); + if (!user.getRegTotal().equals(0)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); + entity.setAvgIssue(avgIssueCount); + } }); @@ -227,7 +231,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map result) { - DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMMDD)); + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMM)); ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(dimIdBean, ScreenUserJoinEntity.class); if (org instanceof DimGridEntity) { DimGridEntity grid = (DimGridEntity) org; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 7853b0c69b..acbb43dcbf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -71,7 +71,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } @Override - public void extractMonthlyAll(ExtractOriginFormDTO formDTO) { + public void extractMonthlyAll(ExtractScreenFormDTO formDTO) { List customerIds = new ArrayList<>(); if (StringUtils.isNotBlank(formDTO.getCustomerId())) { @@ -83,13 +83,13 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } if (!CollectionUtils.isEmpty(customerIds)) { customerIds.forEach(customerId -> { - if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { - List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); - daysBetween.forEach(dateId -> { - extractMonthly(customerId, dateId); + if (StringUtils.isNotBlank(formDTO.getStartMonth()) && StringUtils.isNotBlank(formDTO.getEndMonth())) { + List daysBetween = DateUtils.getMonthBetween(formDTO.getStartDate(), formDTO.getEndDate()); + daysBetween.forEach(monthId -> { + extractMonthly(customerId, monthId); }); - } else if (StringUtils.isNotBlank(formDTO.getDateId())) { - extractMonthly(customerId, formDTO.getDateId()); + } else if (StringUtils.isNotBlank(formDTO.getMonthId())) { + extractMonthly(customerId, formDTO.getMonthId()); } else { String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); extractMonthly(customerId, dateId); From 44e98321cd557523c71d78168c3ff8398a931eff Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 27 Sep 2020 17:32:57 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=8F=82=E4=B8=8E=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../toscreen/impl/PartyGuideServiceImpl.java | 210 +++++++++--------- .../screen/ScreenPartyBranchDataDao.xml | 5 +- 2 files changed, 102 insertions(+), 113 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 12a37d90a9..911ea86352 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -1,8 +1,8 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ScreenConstant; import com.epmet.dto.extract.form.ScreenExtractFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; @@ -81,7 +81,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (!CollectionUtils.isEmpty(customerIds)){ String finalMonthId = monthId; customerIds.forEach(oneCustomerId -> { - partyGuideExtractParty(oneCustomerId, finalMonthId); +// partyGuideExtractParty(oneCustomerId, finalMonthId); partyGuideExtractOrganize(oneCustomerId,finalMonthId); }); } @@ -271,67 +271,79 @@ public class PartyGuideServiceImpl implements PartyGuideService { */ public void disPoseOrganize(List agencyIdList, Boolean isGrid, String customerId, String monthId){ if (!CollectionUtils.isEmpty(agencyIdList)){ - List result = new ArrayList<>(); - List orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + List orgIds = new ArrayList<>(); + List orgIdsAgency = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + orgIds.addAll(orgIdsAgency); + orgIdsAgency.forEach(orgId -> { + Map agencyMap = agencyService.selectAllSubAgencyId(orgId, customerId); + List gridIds = (List) agencyMap.get(orgId); + orgIds.addAll(gridIds); + }); + List directGridIds = gridService.selectDirectGrid(orgIdsAgency); + if (isGrid == false){ + orgIds.addAll(directGridIds.stream().map(m -> m.getGridId()).collect(Collectors.toList())); + } List joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); + List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); + List screenPartyBranchDataListAgencyAll = gridService.selectAllGridIdToOrganize(customerId, monthId); + screenPartyBranchDataListAgencyAll.addAll(screenPartyBranchData); + List finalResult = new ArrayList<>(); + screenPartyBranchDataListAgencyAll.forEach(rl -> { + orgIds.forEach(orgId -> { + if (rl.getOrgId().equals(orgId)){ + finalResult.add(rl); + } + }); + }); if (isGrid == true){ List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); agencyIdList.forEach(agency -> { - String agencyId = agency.getAgencyId(); - Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); - List gridIds = (List) agencyMap.get(agencyId); - orgIds.addAll(gridIds); - List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, gridIds); - if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ - screenPartyBranchDataList.forEach(party -> { - joinUserCountList.forEach(join -> { - if (party.getOrgId().equals(join.getOrgId())){ - party.setAverageJoinUserCount(join.getJoinUserCount()); - party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); - party.setYearId(DateUtils.getYearId(monthId)); - } - }); + List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, orgIds); + finalResult.forEach(fl -> { + screenPartyBranchDataList.forEach(sp -> { + if (fl.getOrgId().equals(sp.getOrgId())){ + fl.setOrganizeCount(sp.getOrganizeCount()); + } }); - } - result.addAll(screenPartyBranchDataList); + joinUserCountList.forEach(join -> { + if (fl.getOrgId().equals(join.getOrgId())){ + fl.setJoinUserCount(join.getJoinUserCount()); + } + }); + fl.setAverageJoinUserCount(fl.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : fl.getJoinUserCount() / fl.getOrganizeCount()); + }); }); // 社区级别的 - Map> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId)); - List orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); - groupByAgency.forEach((agencyId,actList) -> { - ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO(); - if (!CollectionUtils.isEmpty(orgNameAgencyList)){ - orgNameAgencyList.forEach(name -> { - if (agencyId.equals(name.getAgencyId())){ - form.setOrgName(name.getAgencyName()); - form.setParentId(name.getParentId()); - } + Map> groupByType = finalResult.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getOrgType)); + groupByType.forEach((orgType,list) -> { + if (orgType.equals(ScreenConstant.GRID)){ + Map> groupByAgency = finalResult.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId)); + groupByAgency.forEach((agencyId,actList) -> { + finalResult.forEach(fl -> { + if (fl.getOrgId().equals(agencyId)){ + fl.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); + fl.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + fl.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + fl.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + fl.setAverageJoinUserCount(fl.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (fl.getJoinUserCount() / fl.getOrganizeCount())); + } + }); }); } - form.setOrgId(agencyId); - form.setCustomerId(customerId); - form.setOrgType(ScreenConstant.AGENCY); - form.setMonthId(monthId); - form.setYearId(DateUtils.getYearId(monthId)); - form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); - form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); - screenPartyBranchDataByAgencyList.forEach(organize -> { - if (organize.getOrgId().equals(agencyId)){ - form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); - } - }); - joinUserCountByAgencyList.forEach(join -> { - if (join.getOrgId().equals(agencyId)){ - form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); - } - }); - form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); - result.add(form); }); - delAndInsertOrganize(result,customerId,monthId,orgIds); + log.error("结果"+JSON.toJSONString(finalResult)); + delOrganize(customerId,monthId,orgIds); + insertOrganize(finalResult); }else { - List directGridIds = gridService.selectDirectGrid(orgIds); agencyIdList.forEach(agency -> { String agencyId = agency.getAgencyId(); List disGridIds = new ArrayList<>(); @@ -343,52 +355,46 @@ public class PartyGuideServiceImpl implements PartyGuideService { // 存在直属网格 if (!CollectionUtils.isEmpty(disGridIds)){ orgIds.addAll(disGridIds); - List gridResult = new ArrayList<>(); List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); - if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ - screenPartyBranchDataList.forEach(party -> { - joinUserCountList.forEach(join -> { - if (party.getOrgId().equals(join.getOrgId())){ - party.setAverageJoinUserCount(join.getJoinUserCount()); - party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); - party.setYearId(DateUtils.getYearId(monthId)); - } - }); - ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); - gridResult.add(copyParty); + finalResult.forEach(r -> { + screenPartyBranchDataList.forEach(party ->{ + if (r.getOrgId().equals(party.getOrgId())){ + r.setOrganizeCount(party.getOrganizeCount()); + } }); - } + joinUserCountList.forEach(join -> { + if (r.getOrgId().equals(join.getOrgId())){ + r.setJoinUserCount(join.getJoinUserCount()); + } + }); + r.setAverageJoinUserCount(r.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : r.getJoinUserCount() / r.getOrganizeCount()); + }); } + delOrganize(customerId,monthId,orgIds); List disPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByOrgId(customerId, monthId, disGridIds); List screenPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByParentId(customerId, monthId, agencyId); screenPartyBranchDataList.addAll(disPartyBranchDataList); if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ - ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO(); - form.setOrgId(agencyId); - form.setOrgType(ScreenConstant.AGENCY); - form.setOrgName(screenPartyBranchDataList.get(NumConstant.ZERO).getOrgName()); - form.setCustomerId(customerId); - form.setMonthId(monthId); - form.setYearId(DateUtils.getYearId(monthId)); - form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId()); - form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); - form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); - screenPartyBranchDataByAgencyList.forEach(organize -> { - if (organize.getOrgId().equals(agencyId)){ - form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); - } - }); - joinUserCountByAgencyList.forEach(join -> { - if (join.getOrgId().equals(agencyId)){ - form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); - } + finalResult.forEach(form -> { + form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); + form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); + }); - form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); - result.add(form); } }); - delAndInsertOrganize(result,customerId,monthId,orgIds); + insertOrganize(finalResult); } } } @@ -478,35 +484,19 @@ public class PartyGuideServiceImpl implements PartyGuideService { * @date 2020/9/25 5:50 下午 */ @Transactional(rollbackFor = Exception.class) - public void delAndInsertOrganize(List result,String customerId, String monthId, List orgIds){ - List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); - List screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId); - screenPartyBranchDataList.addAll(screenPartyBranchData); - List finalResult = new ArrayList<>(); - screenPartyBranchDataList.forEach(rl -> { - orgIds.forEach(orgId -> { - if (rl.getOrgId().equals(orgId)){ - finalResult.add(rl); - } - }); + public void insertOrganize(List result){ + List> partition = ListUtils.partition(result, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + partyBranchDataService.insertScreenPartyBranchData(p); }); - if (!CollectionUtils.isEmpty(result)){ - finalResult.forEach(fr -> { - result.forEach(r -> { - if (fr.getOrgId().equals(r.getOrgId())){ - BeanUtils.copyProperties(r,fr); - } - }); - }); - } + } + + @Transactional(rollbackFor = Exception.class) + public void delOrganize(String customerId, String monthId, List orgIds){ Integer delNum; do { delNum = partyBranchDataService.deleteOldScreenPartyBranchData(customerId, monthId, orgIds); }while (delNum > NumConstant.ZERO); - List> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); - partition.forEach(p -> { - partyBranchDataService.insertScreenPartyBranchData(p); - }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml index 5c5741a289..c8b84d14b4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml @@ -151,9 +151,8 @@ spbd.CUSTOMER_ID, spbd.YEAR_ID, spbd.MONTH_ID, - spbd.PARENT_ID AS orgId, + spbd.ORG_ID AS orgId, spbd.ORG_TYPE, - sca.AGENCY_NAME AS orgName, IFNULL(spbd.ORGANIZE_COUNT,0) AS organizeCount, IFNULL(spbd.JOIN_USER_COUNT,0) AS joinUserCount FROM @@ -166,6 +165,6 @@ AND spbd.ORG_TYPE = 'agency' AND spbd.CUSTOMER_ID = #{customerId} AND spbd.MONTH_ID = #{monthId} - AND spbd.ORG_ID = #{parentId} + AND spbd.PARENT_ID = #{parentId} From 312dd358d6abde21af5c56ce53b3cea2e5236999 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Sun, 27 Sep 2020 17:46:37 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E5=85=88=E8=BF=9B=E6=8E=92=E8=A1=8C?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/OrgStatisticsResultDTO.java | 3 +- .../com/epmet/controller/DemoController.java | 9 + .../extract/FactOriginGroupMainDailyDao.java | 24 ++ .../extract/FactOriginIssueMainDailyDao.java | 23 ++ .../extract/FactOriginProjectLogDailyDao.java | 22 ++ .../FactOriginProjectMainDailyDao.java | 24 +- .../extract/FactOriginTopicMainDailyDao.java | 23 ++ .../screen/ScreenOrgRankDataDao.java | 34 +++ .../user/FactRegUserAgencyMonthlyDao.java | 13 + .../stats/user/FactRegUserGridMonthlyDao.java | 10 + .../FactOriginGroupMainDailyService.java | 22 ++ .../FactOriginIssueMainDailyService.java | 24 ++ .../FactOriginProjectLogDailyService.java | 21 ++ .../FactOriginProjectMainDailyService.java | 21 ++ .../FactOriginTopicMainDailyService.java | 22 ++ .../FactOriginGroupMainDailyServiceImpl.java | 11 + .../FactOriginIssueMainDailyServiceImpl.java | 13 + .../FactOriginProjectLogDailyServiceImpl.java | 10 + ...FactOriginProjectMainDailyServiceImpl.java | 10 + .../FactOriginTopicMainDailyServiceImpl.java | 11 + .../toscreen/OrgRankExtractService.java | 41 +++ .../GovernRankDataExtractServiceImpl.java | 182 +++++++----- .../impl/OrgRankExtractServiceImpl.java | 260 ++++++++++++++++++ .../screen/ScreenOrgRankDataService.java | 29 ++ .../impl/ScreenOrgRankDataServiceImpl.java | 47 ++++ .../user/FactRegUserAgencyMonthlyService.java | 12 + .../user/FactRegUserGridMonthlyService.java | 11 + .../FactRegUserAgencyMonthlyServiceImpl.java | 5 + .../FactRegUserGridMonthlyServiceImpl.java | 5 + .../extract/FactOriginGroupMainDailyDao.xml | 26 ++ .../extract/FactOriginIssueMainDailyDao.xml | 24 ++ .../extract/FactOriginProjectLogDailyDao.xml | 68 +++++ .../extract/FactOriginProjectMainDailyDao.xml | 24 ++ .../extract/FactOriginTopicMainDailyDao.xml | 24 ++ .../FactIndexGovrnAblityOrgMonthlyDao.xml | 3 +- .../screen/ScreenOrgRankDataDao.xml | 57 ++++ .../user/FactRegUserAgencyMonthlyDao.xml | 13 + .../stats/user/FactRegUserGridMonthlyDao.xml | 11 + 38 files changed, 1126 insertions(+), 66 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/OrgRankExtractService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java index ad170c5b96..d7fca3b15d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.extract.result; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * @author zhaoqifeng @@ -17,5 +18,5 @@ public class OrgStatisticsResultDTO implements Serializable { private String orgId; private Integer count; private Integer sum; - private String ratio; + private BigDecimal ratio; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 708bc70d60..ea3cdfbc53 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -105,6 +105,8 @@ public class DemoController { private ScreenCentralZoneDataAbsorptionService screenCentralZoneDataAbsorptionService; @Autowired private GovernRankDataExtractService governRankDataExtractService; + @Autowired + private OrgRankExtractService orgRankExtractService; @GetMapping("testAlarm") public void testAlarm() { @@ -699,5 +701,12 @@ public class DemoController { return new Result(); } + @PostMapping("orgRank") + public Result orgRank(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ + orgRankExtractService.extractGridData(formDTO.getCustomerId(), formDTO.getDateId()); + orgRankExtractService.extractCommunityData(formDTO.getCustomerId(), formDTO.getDateId()); + orgRankExtractService.extractStreetData(formDTO.getCustomerId(), formDTO.getDateId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index f1ad597f68..e5e603a40f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -18,6 +18,9 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -159,4 +162,25 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectDistinctGroupMemberCount(@Param("customerId") String customerId, @Param("groupField") String groupField); + + /** + * 获取网格内小组数量 + * @author zhaoqifeng + * @date 2020/9/27 14:37 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectGridGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * 获取组织内网格数量 + * @author zhaoqifeng + * @date 2020/9/27 14:37 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectOrgGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level") String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index 79a1487328..794b9f091a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.GridIssueCountResultDTO; import com.epmet.dto.extract.form.IssueMainDailyFormDTO; import com.epmet.dto.extract.result.GridProjectCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.ShiftProjectCountResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -183,4 +184,26 @@ public interface FactOriginIssueMainDailyDao extends BaseDao + */ + List selectGridIssueCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * 组织内议题总数 + * @author zhaoqifeng + * @date 2020/9/27 14:59 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectOrgIssueCount(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level") String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 422c9f83ea..63e54d4354 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -136,4 +136,26 @@ public interface FactOriginProjectLogDailyDao extends BaseDao */ List selectOrgResponse(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("level")String level); + + /** + * 网格满意率 + * @author zhaoqifeng + * @date 2020/9/27 15:52 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectGridSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * 组织满意率 + * @author zhaoqifeng + * @date 2020/9/27 15:52 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectOrgSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level")String level); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 01bf423d48..300d1d61ba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -84,7 +84,6 @@ public interface FactOriginProjectMainDailyDao extends BaseDao> @@ -169,4 +168,27 @@ public interface FactOriginProjectMainDailyDao extends BaseDao */ List getGridResolveProject(@Param("customerId") String customerId, @Param("monthId")String monthId); + + + /** + * 网格解决项目数 + * @author zhaoqifeng + * @date 2020/9/25 15:16 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridProjectCount(@Param("customerId") String customerId, @Param("monthId")String monthId); + + /** + * 组织解决项目数 + * @author zhaoqifeng + * @date 2020/9/25 15:16 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgProjectCount(@Param("customerId") String customerId, @Param("monthId")String monthId, + @Param("level") String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java index 9a514557e7..547d713e90 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.result.CreateTopicCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -116,4 +117,26 @@ public interface FactOriginTopicMainDailyDao extends BaseDao + */ + List selectGridTopicCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * 组织内话题总数 + * @author zhaoqifeng + * @date 2020/9/27 14:59 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectOrgTopicCount(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level") String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenOrgRankDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenOrgRankDataDao.java index a49376a255..1b2e69b96b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenOrgRankDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenOrgRankDataDao.java @@ -56,4 +56,38 @@ public interface ScreenOrgRankDataDao extends BaseDao { * @Date 10:52 2020-08-18 **/ void batchInsertOrgRankData(@Param("list") List list, @Param("customerId")String customerId); + + /** + * 初始化组织数据 + * @author zhaoqifeng + * @date 2020/9/27 10:14 + * @param customerId + * @param level + * @return java.util.List + */ + List initAgencyDataList(@Param("customerId") String customerId, @Param("level") String level); + + /** + * 初始化网格数据 + * @author zhaoqifeng + * @date 2020/9/27 10:14 + * @param customerId + * @return java.util.List + */ + List initGridDataList(@Param("customerId") String customerId); + + /** + * 删除旧数据 + * @author zhaoqifeng + * @date 2020/9/27 10:27 + * @param customerId + * @param orgType + * @param monthId + * @param deleteSize + * @param orgIds + * @return java.lang.Integer + */ + Integer deleteRankData(@Param("customerId") String customerId, @Param("orgType") String orgType, @Param("monthId") String monthId, + @Param("deleteSize") Integer deleteSize, + @Param("orgIds")List orgIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java index bf0b951134..5df37b7ff5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java @@ -40,4 +40,17 @@ public interface FactRegUserAgencyMonthlyDao extends BaseDao selectAgencyUserCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * 查询机关下各用户数量 + * @author zhaoqifeng + * @date 2020/9/27 16:39 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectOrgUserCountByCustomer(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level") String level); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java index 479ecf5902..744f9ffd0a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java @@ -48,4 +48,14 @@ public interface FactRegUserGridMonthlyDao extends BaseDao selectGridUserCount(String customerId, String monthId); + /** + * 查询网格下各用户数量 + * @author zhaoqifeng + * @date 2020/9/27 13:59 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectGridUserCountByCustomer(@Param("customerId") String customerId, @Param("monthId") String monthId); + } \ 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/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index b603d56d02..f6fc9f2dc6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; @@ -84,4 +85,25 @@ public interface FactOriginGroupMainDailyService extends BaseService selectDistinctGroupMemberCount(String customerId, String groupField); + + /** + * 获取网格内小组数量 + * @author zhaoqifeng + * @date 2020/9/27 14:35 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridGroupCount(String customerId, String monthId); + + /** + * 获取组织内小组数量 + * @author zhaoqifeng + * @date 2020/9/27 14:35 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgGroupCount(String customerId, String monthId, String level); } \ 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/FactOriginIssueMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java index 8afc53cd16..de2ac6f8c7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java @@ -18,8 +18,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; +import java.util.List; + /** * 议题主表 * @@ -86,4 +89,25 @@ public interface FactOriginIssueMainDailyService extends BaseService + */ + List getGridIssueCount(String customerId, String monthId); + + /** + * 组织内议题数 + * @author zhaoqifeng + * @date 2020/9/27 15:11 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgIssueCount(String customerId, String monthId, String level); } \ 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/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java index f95de230b7..b3c8c8958e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java @@ -218,4 +218,25 @@ public interface FactOriginProjectLogDailyService extends BaseService getOrgResponse(String customerId, String monthId, String level); + /** + * 网格满意率 + * @author zhaoqifeng + * @date 2020/9/27 16:06 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridSatisfaction(String customerId, String monthId); + + /** + * 组织满意率 + * @author zhaoqifeng + * @date 2020/9/27 16:06 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgSatisfaction(String customerId, String monthId, String level); + } \ 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/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index bc061d6064..86404e1bde 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -216,4 +216,25 @@ public interface FactOriginProjectMainDailyService extends BaseService */ List getGridResolveProject(String customerId, String monthId); + + /** + * 网格项目数 + * @author zhaoqifeng + * @date 2020/9/27 15:18 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridProjectCount(String customerId, String monthId); + + /** + * 组织项目数 + * @author zhaoqifeng + * @date 2020/9/27 15:19 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgProjectCount(String customerId, String monthId, String level); } \ 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/FactOriginTopicMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java index d217e4d3eb..e059614d26 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java @@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.result.CreateTopicCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; import java.util.List; @@ -90,4 +91,25 @@ public interface FactOriginTopicMainDailyService extends BaseService + */ + List getGridTopicCount(String customerId, String monthId); + + /** + * 组织内话题数 + * @author zhaoqifeng + * @date 2020/9/27 15:05 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgTopicCount(String customerId, String monthId, String level); } \ 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/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index b19ea0df4a..4c5afda59a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; @@ -120,4 +121,14 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl getGridGroupCount(String customerId, String monthId) { + return baseDao.selectGridGroupCount(customerId, monthId); + } + + @Override + public List getOrgGroupCount(String customerId, String monthId, String level) { + return baseDao.selectOrgGroupCount(customerId, monthId, level); + } + } \ 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/FactOriginIssueMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java index c67d2d8151..0eac851c63 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java @@ -21,11 +21,14 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueMainDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.List; + /** * 议题主表 * @@ -114,4 +117,14 @@ public class FactOriginIssueMainDailyServiceImpl extends BaseServiceImpl getGridIssueCount(String customerId, String monthId) { + return baseDao.selectGridIssueCount(customerId, monthId); + } + + @Override + public List getOrgIssueCount(String customerId, String monthId, String level) { + return baseDao.selectOrgIssueCount(customerId, monthId, level); + } } \ 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/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index f966247b6e..070770a414 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -277,5 +277,15 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl getGridSatisfaction(String customerId, String monthId) { + return baseDao.selectGridSatisfaction(customerId, monthId); + } + + @Override + public List getOrgSatisfaction(String customerId, String monthId, String level) { + return baseDao.selectOrgSatisfaction(customerId, monthId, level); + } + } \ 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/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 6e8c7124e8..d735b59fba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -213,4 +213,14 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl getGridResolveProject(String customerId, String monthId) { return baseDao.getGridResolveProject(customerId, monthId); } + + @Override + public List getGridProjectCount(String customerId, String monthId) { + return baseDao.getGridProjectCount(customerId, monthId); + } + + @Override + public List getOrgProjectCount(String customerId, String monthId, String level) { + return baseDao.getOrgProjectCount(customerId, monthId, level); + } } \ 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/FactOriginTopicMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java index e55104f01c..e281b9518a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.dao.evaluationindex.extract.FactOriginTopicLogDailyDao; import com.epmet.dao.evaluationindex.extract.FactOriginTopicMainDailyDao; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.result.CreateTopicCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.dto.topic.TopicOriginInfoDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; @@ -313,4 +314,14 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl getGridTopicCount(String customerId, String monthId) { + return baseDao.selectGridTopicCount(customerId, monthId); + } + + @Override + public List getOrgTopicCount(String customerId, String monthId, String level) { + return baseDao.selectOrgTopicCount(customerId, monthId, level); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/OrgRankExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/OrgRankExtractService.java new file mode 100644 index 0000000000..9afc2593e4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/OrgRankExtractService.java @@ -0,0 +1,41 @@ +package com.epmet.service.evaluationindex.extract.toscreen; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/27 9:37 + */ +public interface OrgRankExtractService { + /** + * 网格先进排行 + * + * @param customerId + * @param monthId + * @return void + * @author zhaoqifeng + * @date 2020/9/24 15:16 + */ + void extractGridData(String customerId, String monthId); + + /** + * 社区先进排行 + * + * @param customerId + * @param monthId + * @return void + * @author zhaoqifeng + * @date 2020/9/24 15:17 + */ + void extractCommunityData(String customerId, String monthId); + + /** + * 街道先进排行 + * + * @param customerId + * @param monthId + * @return void + * @author zhaoqifeng + * @date 2020/9/24 15:17 + */ + void extractStreetData(String customerId, String monthId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java index 05f90029d5..502a20a32f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java @@ -50,38 +50,57 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (CollectionUtils.isEmpty(list)) { return; } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); list.forEach(entity -> { entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); entity.setMonthId(monthId); }); + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getGridSatisfaction(customerId, monthId); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + //自治率 List gridList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); - list.forEach(entity -> gridList.stream().filter(gridAbility -> entity.getOrgId().equals(gridAbility.getGridId())).forEach(grid -> { - - BigDecimal resolveCount = new BigDecimal(grid.getResolveProjectCount()); - //自治率 - BigDecimal selfCount = new BigDecimal(grid.getSelfSolveProjectCount()); - if(grid.getResolveProjectCount()!= NumConstant.ZERO) { - entity.setGovernRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); - } - //满意率 - entity.setSatisfactionRatio(grid.getSatisfactionRatio()); - })); + if (!CollectionUtils.isEmpty(gridList)) { + list.forEach(entity -> gridList.stream().filter(gridAbility -> entity.getOrgId().equals(gridAbility.getGridId())).forEach(grid -> { + BigDecimal resolveCount = new BigDecimal(grid.getResolveProjectCount()); + BigDecimal selfCount = new BigDecimal(grid.getSelfSolveProjectCount()); + if (grid.getResolveProjectCount() != NumConstant.ZERO) { + entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //响应率 响应次数/流转到网格的次数 List responseList = factOriginProjectLogDailyService.getGridResponse(customerId, monthId); - list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getOrgId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(responseList)) { + list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //解决率 已解决项目数/办结项目数 List resolveList = factOriginProjectMainDailyService.getGridResolveProject(customerId, monthId); - list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getOrgId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(resolveList)) { + list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } screenGovernRankDataService.delAndSaveRankData(customerId, OrgTypeConstant.GRID, monthId, IndexCalConstant.DELETE_SIZE, list); } @@ -92,39 +111,58 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (CollectionUtils.isEmpty(list)) { return; } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); list.forEach(entity -> { entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); entity.setMonthId(monthId); }); - List orgList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, - OrgTypeConstant.COMMUNITY); - list.forEach(entity -> orgList.stream().filter(orgAbility -> entity.getOrgId().equals(orgAbility.getAgencyId())).forEach(org -> { - //满意率 - entity.setSatisfactionRatio(org.getSatisfactionRatio()); - })); + + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //响应率 响应次数/流转到网格的次数 List responseList = factOriginProjectLogDailyService.getOrgResponse(customerId, monthId, OrgTypeConstant.COMMUNITY); - list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(responseList)) { + list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //自制率 自治项目数/办结项目数 List selfList = factOriginProjectMainDailyService.getSelfProject(customerId, monthId, OrgTypeConstant.COMMUNITY); - list.forEach(entity -> selfList.stream().filter(self -> entity.getOrgId().equals(self.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(selfList)) { + list.forEach(entity -> selfList.stream().filter(self -> entity.getOrgId().equals(self.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //解决率 已解决项目数/办结项目数 List resolveList = factOriginProjectMainDailyService.getResolveProject(customerId, monthId, OrgTypeConstant.COMMUNITY); - list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(resolveList)) { + list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } screenGovernRankDataService.delAndSaveRankData(customerId, OrgTypeConstant.AGENCY, monthId, IndexCalConstant.DELETE_SIZE, list); } @@ -134,39 +172,57 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (CollectionUtils.isEmpty(list)) { return; } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); list.forEach(entity -> { entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); entity.setMonthId(monthId); }); - List orgList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, - OrgTypeConstant.STREET); - list.forEach(entity -> orgList.stream().filter(orgAbility -> entity.getOrgId().equals(orgAbility.getAgencyId())).forEach(org -> { - //满意率 - entity.setSatisfactionRatio(org.getSatisfactionRatio()); - })); + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //响应率 响应次数/流转到网格的次数 List responseList = factOriginProjectLogDailyService.getOrgResponse(customerId, monthId, OrgTypeConstant.STREET); - list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(responseList)) { + list.forEach(entity -> responseList.stream().filter(response -> entity.getOrgId().equals(response.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //自制率 自治项目数/办结项目数 List selfList = factOriginProjectMainDailyService.getSelfProject(customerId, monthId, OrgTypeConstant.STREET); - list.forEach(entity -> selfList.stream().filter(self -> entity.getOrgId().equals(self.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(selfList)) { + list.forEach(entity -> selfList.stream().filter(self -> entity.getOrgId().equals(self.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } //解决率 已解决项目数/办结项目数 List resolveList = factOriginProjectMainDailyService.getResolveProject(customerId, monthId, OrgTypeConstant.STREET); - list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getAgencyId())).forEach(dto -> { - BigDecimal sum = new BigDecimal(dto.getSum()); - BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); - })); + if (!CollectionUtils.isEmpty(resolveList)) { + list.forEach(entity -> resolveList.stream().filter(resolve -> entity.getOrgId().equals(resolve.getAgencyId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } screenGovernRankDataService.delAndSaveRankData(customerId, OrgTypeConstant.AGENCY, monthId, IndexCalConstant.DELETE_SIZE, list); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java new file mode 100644 index 0000000000..904ee9d57a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java @@ -0,0 +1,260 @@ +package com.epmet.service.evaluationindex.extract.toscreen.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.OrgTypeConstant; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; +import com.epmet.dto.stats.user.FactRegUserGridMonthlyDTO; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; +import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; +import com.epmet.service.evaluationindex.extract.todata.*; +import com.epmet.service.evaluationindex.extract.toscreen.OrgRankExtractService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; +import com.epmet.service.evaluationindex.screen.ScreenOrgRankDataService; +import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService; +import com.epmet.service.stats.user.FactRegUserGridMonthlyService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/27 9:37 + */ +@Service +@Slf4j +public class OrgRankExtractServiceImpl implements OrgRankExtractService { + @Autowired + private ScreenOrgRankDataService screenOrgRankDataService; + @Autowired + private FactRegUserGridMonthlyService factRegUserGridMonthlyService; + @Autowired + private FactOriginGroupMainDailyService factOriginGroupMainDailyService; + @Autowired + private FactOriginTopicMainDailyService factOriginTopicMainDailyService; + @Autowired + private FactOriginIssueMainDailyService factOriginIssueMainDailyService; + @Autowired + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Autowired + private FactIndexGovrnAblityGridMonthlyService factIndexGovrnAblityGridMonthlyService; + @Autowired + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + @Autowired + private FactRegUserAgencyMonthlyService factRegUserAgencyMonthlyService; + @Autowired + private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; + + @Override + public void extractGridData(String customerId, String monthId) { + List list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.GRID, null); + if (CollectionUtils.isEmpty(list)) { + return; + } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + list.forEach(entity -> { + entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(monthId); + }); + //党员数 + List partyMemberList = factRegUserGridMonthlyService.getGridUserCountByCustomer(customerId, monthId); + if (!CollectionUtils.isEmpty(partyMemberList)) { + list.forEach(entity -> partyMemberList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { + entity.setPartyTotal(dto.getPartymemberTotal()); + })); + } + //小组数 + List groupList = factOriginGroupMainDailyService.getGridGroupCount(customerId, monthId); + if (!CollectionUtils.isEmpty(groupList)) { + list.forEach(entity -> groupList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setGroupTotal(dto.getCount()); + })); + } + //话题数 + List topicList = factOriginTopicMainDailyService.getGridTopicCount(customerId, monthId); + if (!CollectionUtils.isEmpty(topicList)) { + list.forEach(entity -> topicList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setTopicTotal(dto.getCount()); + })); + } + //议题数 + List issueList = factOriginIssueMainDailyService.getGridIssueCount(customerId, monthId); + if (!CollectionUtils.isEmpty(issueList)) { + list.forEach(entity -> issueList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setIssueTotal(dto.getCount()); + })); + } + //项目数 + List projectList = factOriginProjectMainDailyService.getGridProjectCount(customerId, monthId); + if (!CollectionUtils.isEmpty(projectList)) { + list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setProjectTotal(dto.getCount()); + })); + } + //结案率 结案数/项目数 + List abilityList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); + if (!CollectionUtils.isEmpty(abilityList)) { + list.forEach(entity -> abilityList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getProjectTotal() != NumConstant.ZERO) { + BigDecimal total = new BigDecimal(dto.getProjectTotal()); + BigDecimal closed = new BigDecimal(dto.getResolveProjectCount()); + entity.setCloseProjectRatio(closed.multiply(hundred).divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); + } + + })); + } + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getGridSatisfaction(customerId, monthId); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + } + + @Override + public void extractCommunityData(String customerId, String monthId) { + List list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.COMMUNITY); + if (CollectionUtils.isEmpty(list)) { + return; + } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + list.forEach(entity -> { + entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(monthId); + }); + //党员数 + List partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, + OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(partyMemberList)) { + list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setPartyTotal(dto.getPartymemberTotal()); + })); + } + //小组数 + List groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(groupList)) { + list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setGroupTotal(dto.getCount()); + })); + } + //话题数 + List topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(topicList)) { + list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setTopicTotal(dto.getCount()); + })); + } + //议题数 + List issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(issueList)) { + list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setIssueTotal(dto.getCount()); + })); + } + //项目数 + List projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(projectList)) { + list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setProjectTotal(dto.getCount()); + })); + } + //结案率 结案数/项目数 + List abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(abilityList)) { + list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setCloseProjectRatio(dto.getClosedProjectRatio()); + })); + } + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + } + + @Override + public void extractStreetData(String customerId, String monthId) { + List list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.STREET); + if (CollectionUtils.isEmpty(list)) { + return; + } + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + list.forEach(entity -> { + entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(monthId); + }); + //党员数 + List partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, + OrgTypeConstant.COMMUNITY); + if (!CollectionUtils.isEmpty(partyMemberList)) { + list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setPartyTotal(dto.getPartymemberTotal()); + })); + } + //小组数 + List groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(groupList)) { + list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setGroupTotal(dto.getCount()); + })); + } + //话题数 + List topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(topicList)) { + list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setTopicTotal(dto.getCount()); + })); + } + //议题数 + List issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(issueList)) { + list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setIssueTotal(dto.getCount()); + })); + } + //项目数 + List projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(projectList)) { + list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + entity.setProjectTotal(dto.getCount()); + })); + } + //结案率 结案数/项目数 + List abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(abilityList)) { + list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + entity.setCloseProjectRatio(dto.getClosedProjectRatio()); + })); + } + //满意率 满意和非常满意占比 + List satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET); + if (!CollectionUtils.isEmpty(satisfactionList)) { + list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenOrgRankDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenOrgRankDataService.java index 3cbb16706f..a6b4ab661c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenOrgRankDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenOrgRankDataService.java @@ -20,6 +20,8 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; +import java.util.List; + /** * 党建引领-组织先进排行榜 * @@ -27,4 +29,31 @@ import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; * @since v1.0.0 2020-09-22 */ public interface ScreenOrgRankDataService extends BaseService { + + /** + * 构造screen_govern_rank_data 初始数据,先赋值为0 + * + * @param customerId + * @param orgType + * @param agencyLevel + * @return java.util.List + * @author zhaoqifeng + * @date 2020/9/24 14:41 + */ + List initList(String customerId, String orgType, String agencyLevel); + + /** + * 保存抽取结果 + * + * @param customerId + * @param orgType + * @param monthId + * @param deleteSize + * @param entityList + * @return void + * @author zhaoqifeng + * @date 2020/9/25 10:32 + */ + void delAndSaveRankData(String customerId, String orgType, String monthId, Integer deleteSize, List entityList); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenOrgRankDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenOrgRankDataServiceImpl.java index ece8381e98..ce164aa136 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenOrgRankDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenOrgRankDataServiceImpl.java @@ -18,12 +18,21 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenOrgRankDataDao; import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; import com.epmet.service.evaluationindex.screen.ScreenOrgRankDataService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * 党建引领-组织先进排行榜 * @@ -31,7 +40,45 @@ import org.springframework.stereotype.Service; * @since v1.0.0 2020-09-22 */ @Service +@Slf4j public class ScreenOrgRankDataServiceImpl extends BaseServiceImpl implements ScreenOrgRankDataService { + @Override + @DataSource(DataSourceConstant.STATS) + public List initList(String customerId, String orgType, String agencyLevel) { + List list = new ArrayList<>(); + switch (orgType) { + case OrgTypeConstant.AGENCY: + log.info("组织级别统计"); + list = baseDao.initAgencyDataList(customerId, agencyLevel); + break; + case OrgTypeConstant.GRID: + log.info("网格级别统计"); + list = baseDao.initGridDataList(customerId); + break; + default: + log.info("部门级别统计"); + break; + } + return list; + } + + @Override + @DataSource(DataSourceConstant.EVALUATION_INDEX) + public void delAndSaveRankData(String customerId, String orgType, String monthId, Integer deleteSize, List entityList) { + if (CollectionUtils.isEmpty(entityList)) { + return; + } + List orgIds = new ArrayList<>(); + for (ScreenOrgRankDataEntity entity : entityList) { + orgIds.add(entity.getOrgId()); + } + int deleteNum; + do { + deleteNum = baseDao.deleteRankData(customerId, orgType, monthId, deleteSize, orgIds); + } while (deleteNum != NumConstant.ZERO); + + insertBatch(entityList); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java index bdce57807a..7875beea3f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserAgencyMonthlyService.java @@ -104,4 +104,16 @@ public interface FactRegUserAgencyMonthlyService extends BaseService selectAgencyUserCount(String customerId, String monthId); + + /** + * 查询机关下各用户数量 + * + * @author zhaoqifeng + * @date 2020/9/27 14:02 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getOrgUserCountByCustomer(String customerId, String monthId, String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserGridMonthlyService.java index 860d383906..7917a3c001 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserGridMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactRegUserGridMonthlyService.java @@ -103,4 +103,15 @@ public interface FactRegUserGridMonthlyService extends BaseService selectGridUserCount(String customerId,String monthId); + + /** + * 查询网格下各用户数量 + * + * @author zhaoqifeng + * @date 2020/9/27 14:02 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridUserCountByCustomer(String customerId, String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java index 315609b3bb..b1bc32ea7c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserAgencyMonthlyServiceImpl.java @@ -104,4 +104,9 @@ public class FactRegUserAgencyMonthlyServiceImpl extends BaseServiceImpl getOrgUserCountByCustomer(String customerId, String monthId, String level) { + return baseDao.selectOrgUserCountByCustomer(customerId, monthId, level); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserGridMonthlyServiceImpl.java index 8016f7f613..b859133325 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserGridMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactRegUserGridMonthlyServiceImpl.java @@ -112,4 +112,9 @@ public class FactRegUserGridMonthlyServiceImpl extends BaseServiceImpl getGridUserCountByCustomer(String customerId, String monthId) { + return baseDao.selectGridUserCountByCustomer(customerId, monthId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 8b326f3aa3..7898e849a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -279,4 +279,30 @@ AND CUSTOMER_ID = #{customerId} GROUP by ${groupField,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index 75762c410c..b1085f5058 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -267,4 +267,28 @@ AND t1.CUSTOMER_ID = #{customerId} and t1.PIDS LIKE CONCAT(#{agencyPath},'%') + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index 38fa735f61..f9c0d6d56b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -252,4 +252,72 @@ GROUP BY f.AGENCY_ID ) b ON a.AGENCY_ID = b.AGENCY_ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 5b9c58b5ea..53e896dc7c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -282,4 +282,28 @@ fm.GRID_ID) b ON a.GRID_ID = b.GRID_ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml index 4e6dd8a925..40b67c3951 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -153,4 +153,28 @@ AND m.CUSTOMER_ID = #{customerId} AND m.PIDS LIKE CONCAT(#{agencyPath},'%') + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml index dfdf6c3b59..3a4250d1ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml @@ -120,7 +120,8 @@ AGENCY_ID, MONTH_ID, YEAR_ID, - SATISFACTION_RATIO + SATISFACTION_RATIO, + CLOSED_PROJECT_RATIO FROM fact_index_govrn_ablity_org_monthly WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml index 2cf5f7dc33..95b8e20845 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenOrgRankDataDao.xml @@ -8,6 +8,63 @@ where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} limit 1000; + + delete from screen_org_rank_data + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + + and ORG_TYPE=#{orgType} + + + and + ( + + ORG_ID = #{orgId} + + ) + + limit #{deleteSize} + + + insert into screen_org_rank_data diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml index d81d385479..d5e65f289d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml @@ -101,6 +101,19 @@ AND CUSTOMER_ID = #{customerId} + + \ No newline at end of file From a2893f62ad6036e301d4919ae861dc75e53badb5 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 27 Sep 2020 18:08:15 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=8F=82=E4=B8=8E=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PartyGuideServiceImpl.java | 10 +++------- .../main/resources/mapper/heart/ActUserRelation.xml | 6 ++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 911ea86352..deddc49f27 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -283,7 +283,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (isGrid == false){ orgIds.addAll(directGridIds.stream().map(m -> m.getGridId()).collect(Collectors.toList())); } - List joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, null); List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); List screenPartyBranchDataListAgencyAll = gridService.selectAllGridIdToOrganize(customerId, monthId); @@ -297,7 +297,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); }); if (isGrid == true){ - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); agencyIdList.forEach(agency -> { List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, orgIds); finalResult.forEach(fl -> { @@ -329,7 +328,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { fl.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); } }); - joinUserCountByAgencyList.forEach(join -> { + joinUserCountList.forEach(join -> { if (join.getOrgId().equals(agencyId)){ fl.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); } @@ -340,7 +339,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); } }); - log.error("结果"+JSON.toJSONString(finalResult)); delOrganize(customerId,monthId,orgIds); insertOrganize(finalResult); }else { @@ -355,7 +353,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { // 存在直属网格 if (!CollectionUtils.isEmpty(disGridIds)){ orgIds.addAll(disGridIds); - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); finalResult.forEach(r -> { screenPartyBranchDataList.forEach(party ->{ @@ -384,13 +381,12 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); } }); - joinUserCountByAgencyList.forEach(join -> { + joinUserCountList.forEach(join -> { if (join.getOrgId().equals(agencyId)){ form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); } }); form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); - }); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml index cc1254716e..4d49a71968 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml @@ -10,7 +10,7 @@ COUNT(asr.USER_ID) AS joinUserCount FROM act_user_relation asr - LEFT JOIN act_info ai ON asr.ACT_ID = ai.ID + LEFT JOIN act_info ai ON asr.ACT_ID = ai.ID WHERE ai.DEL_FLAG = 0 AND asr.DEL_FLAG = '0' @@ -18,7 +18,9 @@ AND asr.REWARD_FLAG = 'agree' AND ai.CUSTOMER_ID = #{customerId} AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId} - AND ai.SPONSOR_TYPE = #{orgType} + + AND ai.SPONSOR_TYPE = #{orgType} + GROUP BY ai.SPONSOR_ID From 9361971b47f7019ff746801e9e188663e6e2097f Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 18:23:26 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E8=BE=83=E4=B8=8A=E6=9C=88=20=20=E4=B8=8A=E5=8D=87=E4=B8=8B?= =?UTF-8?q?=E9=99=8D=E4=B8=BA=E8=B4=9F=E6=95=B0=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/GridUserCountResultDTO.java | 4 +-- .../impl/CalGridIndexServiceImpl.java | 2 +- .../impl/PublicPartExtractServiceImpl.java | 26 +++++++++++++------ .../extract/FactOriginGroupMainDailyDao.xml | 2 +- .../extract/FactOriginIssueLogDailyDao.xml | 2 +- .../resources/mapper/stats/DimGridDao.xml | 3 ++- .../user/FactRegUserAgencyMonthlyDao.xml | 4 +-- .../stats/user/FactRegUserGridMonthlyDao.xml | 2 +- 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java index efe3b0747e..b09fadce99 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java @@ -25,9 +25,9 @@ public class GridUserCountResultDTO implements Serializable { private Integer partyCount = NumConstant.ZERO; /** - * 网格ID + * 网格ID 或组织Id */ - private String gridId; + private String orgId; /** * 用户总数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java index 9a9b0c0aa1..4610455b81 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java @@ -145,7 +145,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { // 1. 网格群众用户数 , 网格党员用户数 if (!CollectionUtils.isEmpty(gridUserCountList)){ gridUserCountList.forEach(count -> { - if (r.getGridId().equals(count.getGridId())){ + if (r.getGridId().equals(count.getOrgId())) { r.setUserCount(count.getUserCount()); r.setPartyCount(count.getPartyCount()); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 3146e15a43..6f3a1c9931 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -112,7 +112,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.error("抽取【公众参与-人均议题】,获取注册用户数为空"); return; } - Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o)); + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); issueTotal.forEach(issue -> { String gridId = issue.getGridId(); ScreenUserJoinEntity entity = insertMap.get(gridId); @@ -122,7 +122,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.debug("issue:{}", JSON.toJSONString(issue)); log.debug("user:{}", JSON.toJSONString(user)); if (!user.getRegTotal().equals(0)) { - BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()) + .divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP); entity.setAvgIssue(avgIssueCount); } }); @@ -156,9 +157,13 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { if (memberCount == null) { memberCount = 0; } - bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + if (memberCount != 0) { + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + } + } + if (votedByIssueCount.intValue() != 0) { + entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } - entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); } @@ -179,7 +184,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.error("抽取【公众参与-人均议题】,获取注册用户数为空"); return; } - Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o)); + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); Set agencyIdSet = new HashSet<>(); issueTotal.forEach(issue -> { String agencyId = issue.getAgencyId(); @@ -188,8 +193,11 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(agencyId); //百人人均议题:统计周期内总的议题数/(注册用户数/100) - BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); - entity.setAvgIssue(avgIssueCount); + if (!user.getRegTotal().equals(0)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()) + .divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssue(avgIssueCount); + } }); List> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); @@ -224,7 +232,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); } - entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); + if (votedByIssueCount.intValue() != 0) { + entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); + } } }); screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 7898e849a9..4710c224fa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -277,7 +277,7 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - GROUP by ${groupField,jdbcType=VARCHAR} + GROUP by ${groupField} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index 8b74563b15..b83e517441 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -15,7 +15,8 @@ SELECT ID, CUSTOMER_ID, - AGENCY_ID + AGENCY_ID, + GRID_NAME FROM dim_grid WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml index d5e65f289d..7d01629a99 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml @@ -119,10 +119,10 @@ SELECT REG_INCR, PARTYMEMBER_INCR, - AGENCY_ID, + AGENCY_ID as orgId, REG_TOTAL FROM - fact_reg_user_grid_monthly + fact_reg_user_agency_monthly WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml index 44392a8741..209d13e228 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml @@ -111,7 +111,7 @@ SELECT REG_INCR, PARTYMEMBER_INCR, - GRID_ID, + GRID_ID as orgId, REG_TOTAL FROM fact_reg_user_grid_monthly From 43d523df4523b9fdfc9db48498c67fd40e2788ce Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 18:26:24 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E6=B3=A8=E6=84=8F/=E9=99=A4=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PublicPartExtractServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 6f3a1c9931..6ad492f3b8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -158,7 +158,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { memberCount = 0; } if (memberCount != 0) { - bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount * 1.0)); } } if (votedByIssueCount.intValue() != 0) { @@ -230,7 +230,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { if (memberCount == null) { memberCount = 0; } - bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount)); + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount * 1.0)); } if (votedByIssueCount.intValue() != 0) { entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); From c9968f3453101df07fa309cbaf7399d0aab168fd Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 18:27:51 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E6=B3=A8=E6=84=8F/=E9=99=A4=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PublicPartExtractServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 6ad492f3b8..7ccb83368f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -158,7 +158,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { memberCount = 0; } if (memberCount != 0) { - bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount * 1.0)); + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / (memberCount * 1.0))); } } if (votedByIssueCount.intValue() != 0) { @@ -230,7 +230,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { if (memberCount == null) { memberCount = 0; } - bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount * 1.0)); + bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / (memberCount * 1.0))); } if (votedByIssueCount.intValue() != 0) { entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); From 39b7e6179d9923f27020ae24d0411d0dbf2f92b3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 27 Sep 2020 18:35:36 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=20=E5=B9=B3=E5=9D=87?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E5=BA=A6=E4=BF=9D=E7=95=99=E4=B8=80=E4=BD=8D?= =?UTF-8?q?=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/result/PublicPartiProfileResultDTO.java | 7 ++++--- .../src/main/resources/mapper/screen/ScreenUserJoinDao.xml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java index c5744d0cdd..16637a9896 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * @Description 3、公众参与概况返参DTO @@ -24,7 +25,7 @@ public class PublicPartiProfileResultDTO implements Serializable { * */ private String monthTrend = ""; - private Integer averageIssue = NumConstant.ZERO; + private BigDecimal averageIssue = new BigDecimal(NumConstant.ZERO); /** * 较上月百分比 @@ -38,8 +39,8 @@ public class PublicPartiProfileResultDTO implements Serializable { /** * 平均参与度 - * */ - private Integer averageJoin = NumConstant.ZERO; + */ + private BigDecimal averageJoin = new BigDecimal(NumConstant.ZERO); private String joinCompareLatestMonth = ""; diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index cbbc5fe211..7d7cde6449 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -7,10 +7,10 @@