From 9e3a4228ca67b51bf44fbb4bd3391b34f7fd49e1 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sun, 27 Sep 2020 15:00:24 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E5=8A=9E=E7=BB=93=E6=95=88=E7=8E=87?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=94=BE=E5=85=A5=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataToIndex/impl/IndexCollCommunityServiceImpl.java | 4 +++- .../dataToIndex/impl/IndexCollStreetServiceImpl.java | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java index 6cd619a2fd..2ed9e35483 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java @@ -26,6 +26,7 @@ import java.math.RoundingMode; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -143,7 +144,8 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService entity.setClosedProjectRatio(BigDecimal.ZERO); } //办结效率 - entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId())); + entity.setHandleProjectRatio(Optional.ofNullable(efficiencyMap.get(entity.getAgencyId())).orElse(BigDecimal.ZERO)); + }); factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java index 896d2d47bd..256ac5b76f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java @@ -26,6 +26,7 @@ import java.math.RoundingMode; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -125,14 +126,16 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { BigDecimal element = new BigDecimal(entity.getClosedProjectCount()); //分母,即机关参与过的项目数(去重) Integer denominator = agencyParticipatedCount.get(entity.getAgencyId()); - if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) { + if (null != denominator && denominator != NumConstant.ZERO) { //办结率 entity.setClosedProjectRatio( element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP) ); + }else{ + entity.setClosedProjectRatio(BigDecimal.ZERO); } //办结效率 - entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId())); + entity.setHandleProjectRatio(Optional.ofNullable(efficiencyMap.get(entity.getAgencyId())).orElse(BigDecimal.ZERO)); }); factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); 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 02/16] =?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 03/16] =?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 04/16] =?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 05/16] =?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 06/16] =?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 07/16] =?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 08/16] =?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 09/16] =?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 10/16] =?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 11/16] =?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 12/16] =?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 13/16] =?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 @@ + + + + \ No newline at end of file