From f270088f18fd87cda1b1f070cf1624119884dbf6 Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 11 Sep 2020 14:00:37 +0800 Subject: [PATCH 01/23] =?UTF-8?q?data-report=20log=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0local=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-report-server/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml index 793be083a1..1be215aa54 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + From 0bcdd40b7778592747d3dfb40b8a314c525e9ef0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 13 Sep 2020 14:25:53 +0800 Subject: [PATCH 02/23] =?UTF-8?q?sql=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/GovStaffRoleDao.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index a9da37f9d9..c8bd19b151 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -82,8 +82,10 @@ gsr.del_flag = 0 AND sr.del_flag = 0 AND - - sr.staff_id = #{userId} - + ( + + sr.staff_id = #{userId} + + ) \ No newline at end of file From caee1c7eb3fb7a4f972dec507f13d0b866f2841b Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 14 Sep 2020 09:39:31 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E5=85=9A=E5=91=98=E5=B9=B4=E9=BE=84?= =?UTF-8?q?=E5=88=86=E5=B8=83=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=BANaN=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/GrassrootsPartyDevServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java index 619eba4625..73ebfc5c14 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java @@ -86,7 +86,11 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) { - return screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + PartymemberAgeDistributionResultDTO ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + if(null == ageInfo){ + ageInfo = new PartymemberAgeDistributionResultDTO(); + } + return ageInfo; } /** From 2c4b5c7dd1a2fbf08c8a6958e514c38d993ba495 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 14 Sep 2020 09:45:51 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E6=8C=87=E6=A0=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndexCalculateCommunityServiceImpl.java | 60 +++++++++---------- .../IndexCalculateDistrictServiceImpl.java | 5 -- .../impl/IndexCalculateStreetServiceImpl.java | 6 -- 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 4821e0ee59..a1cd97e164 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -69,6 +69,33 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni @Autowired private CommunitySubScoreDao communitySubScoreDao; + /** + * @param customerId + * @param monthId + * @Description 计算社区相关总分 + * @author zxc + * @date 2020/9/1 4:12 下午 + */ + public Boolean calCommunityAll(String customerId, String monthId) { + Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力 + if (!aBoolean.equals(true)) { + throw new RenException("calculate community-party-ability failure ......"); + } + Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力 + if (!bBoolean.equals(true)) { + throw new RenException("calculate community-govern-ability failure ......"); + } + Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力 + if (!cBoolean.equals(true)) { + throw new RenException("calculate community-service-ability failure ......"); + } + Boolean dBoolean = communityRelate(customerId, monthId); + if (!dBoolean.equals(true)) { + throw new RenException("calculate community-all insert failure ......"); + } + return true; + } + /** * @param customerId * @Description 社区名义发文数量计算【党建能力】 @@ -91,7 +118,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.error(IndexCalConstant.GRID_PARTY_AVG_NULL); - return; } else { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -112,7 +138,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.error(IndexCalConstant.COMMUNITY_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -166,7 +191,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridGovernAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridGovernAvg)){ log.error("社区下级治理能力平均分集合为空"); - return; }else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); @@ -187,7 +211,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -241,7 +264,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridServiceAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridServiceAvg)) { log.error("查询社区下级所有网格服务能力得分平均值集合为空"); - //todo return; } else { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE); @@ -261,7 +283,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -336,33 +357,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni return true; } - /** - * @param customerId - * @param monthId - * @Description 计算社区相关总分 - * @author zxc - * @date 2020/9/1 4:12 下午 - */ - public Boolean calCommunityAll(String customerId, String monthId) { - Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力 - if (!aBoolean.equals(true)) { - throw new RenException("calculate community-party-ability failure ......"); - } - Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力 - if (!bBoolean.equals(true)) { - throw new RenException("calculate community-govern-ability failure ......"); - } - Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力 - if (!cBoolean.equals(true)) { - throw new RenException("calculate community-service-ability failure ......"); - } - Boolean dBoolean = communityRelate(customerId, monthId); - if (!dBoolean.equals(true)) { - throw new RenException("calculate community-all insert failure ......"); - } - return true; - } - /** * @param list * @Description BigDecimal类型获取最大数和最小数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 8ae71e38d1..3143fdf4e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -116,7 +116,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); - return; } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -137,7 +136,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.error(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -191,7 +189,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(districtGovernAvgList)) { log.error("查询所有街道治理能力平均值集合为空"); - return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); @@ -211,7 +208,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(deptScoreAvgList)) { log.error("查询所有直属部门治理能力平均值集合为空"); - //return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); @@ -261,7 +257,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(subStreetAvgList)) { log.error("查询区下属街道服务能力汇总平均值集合为空"); - return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 5fb28ac104..dfec8da308 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -119,7 +119,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); - //todo return; } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); Integer indexEnd = NumConstant.TEN; @@ -141,7 +140,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId, IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(mapList)) { log.error(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldName)) { @@ -194,7 +192,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridGovernAvg)){ log.error("查询街道下属所有社区治理能力汇总为空"); - //todo return; }else if (subGridGovernAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); @@ -215,7 +212,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -269,7 +265,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subCommServiceAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subCommServiceAvg)) { log.error("查询街道下属社区服务能力得分平均值为空"); - //todo return; } else if (subCommServiceAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE); @@ -289,7 +284,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { From d5b1c5a22559df7c44bb28119372ce8ee19d708b Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 09:52:18 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E7=AE=97=E6=B3=95=20=E8=BF=94=E5=9B=9E=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/normalizing/batch/BatchScoreCalculator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index c171f62300..b0ee8fa0ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -37,7 +37,7 @@ public class BatchScoreCalculator { } /** - * 执行计算,以样本的所有指标总得分及明细分数值 + * 执行计算,以样本的所有指标总得分(原始值)及明细分数(归一后的值 不乘以权重)值 * * @param indexInputVOS * @return @@ -56,7 +56,9 @@ public class BatchScoreCalculator { //遍历该指标下的每个数据 for (SampleValue vo : indexValueVOs) { String sampleId = vo.getSampleId(); - BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight).setScale(6, RoundingMode.HALF_UP); + //归一后的值 + BigDecimal normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); + BigDecimal score = scoreCalculator.normalize(normalizeValue, weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); if (result == null) { @@ -67,7 +69,7 @@ public class BatchScoreCalculator { result.setDetails(new ArrayList<>()); scoreCountOfSamples.put(sampleId, result); } - IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), score, idx.getWeight()); + IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), normalizeValue, idx.getWeight()); result.getDetails().add(sampleScore); result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP)); } From 2595269922f85278caeedd0dd83160f7985eb98c Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 14 Sep 2020 09:58:27 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=9F=E8=AE=A1-=E9=87=8D=E6=96=B0=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=89=80=E6=9C=89pendding=E4=B8=AD=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/redis/RedisKeys.java | 10 +- .../com/epmet/constant/CalculateStatus.java | 13 +++ .../controller/IndexCalculateController.java | 110 ++++++++++++++---- .../com/epmet/model/CalculateFlagModel.java | 20 ++++ 4 files changed, 127 insertions(+), 26 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index e1fa2fa2c7..ce57594ad2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -314,6 +314,14 @@ public class RedisKeys { * @return */ public static String getCustomerStatsCalFlag(String customerId) { - return String.format(rootPrefix+"stats:calflag:%s", customerId); + return getCustomerStatsCalKeyPrefix().concat(":").concat(customerId); + } + + /** + * 获取计算标记的key前缀 + * @return + */ + public static String getCustomerStatsCalKeyPrefix() { + return rootPrefix.concat("stats:calflag"); } } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java new file mode 100644 index 0000000000..f4425ee714 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * 计算状态 + * calculating:正在计算中。有实例正在计算 + * pendding:计算暂停,说明计算过程中实例发生重启,等待重新计算 + */ +public interface CalculateStatus { + + String PENDDING = "pendding"; + String CALCULATING = "calculating"; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 8459b99f50..4cecf7f168 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -2,13 +2,16 @@ package com.epmet.controller; import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.CalculateStatus; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.model.CalculateFlagModel; import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.util.DimIdGenerator; @@ -21,10 +24,14 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.concurrent.*; /** @@ -59,20 +66,41 @@ public class IndexCalculateController { private Map futureMap = new HashMap<>(); @PreDestroy - public void clearDataCalFlag() { - // 实例销毁之前,将正在本实例中执行计算的客户列表的计算状态清空 + public void saveCalStatus() { + // 实例销毁之前,将正在本实例中执行计算的客户列表的计算状态修改为pendding,等待其他实例重新计算 futureMap.forEach((customerId, future) -> { - redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); + CalculateFlagModel flag = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); + flag.setStatus(CalculateStatus.PENDDING); + redisUtils.set(RedisKeys.getCustomerStatsCalFlag(customerId), flag); + log.info("客户【%s】正在执行计算,实例发生重启,修改计算状态为:calculation->pendding", customerId); }); } + /** + * 处理暂停中的计算 + */ + @PostMapping("process-pendding-cals") + public void processPenddingCalculate() { + String keyPrefix = RedisKeys.getCustomerStatsCalKeyPrefix(); + Set calFlagKeys = redisUtils.keys(keyPrefix.concat("*")); + calFlagKeys.forEach(key -> { + CalculateFlagModel flag = (CalculateFlagModel) redisUtils.get(key); + if (flag != null && CalculateStatus.PENDDING.equals(flag.getStatus())) { + // 找到状态是pendding的key,执行计算 + CalculateCommonFormDTO form = new CalculateCommonFormDTO(); + form.setCustomerId(flag.getForm().getCustomerId()); + form.setMonthId(flag.getForm().getMonthId()); + indexCalculate(form); + } + }); + } /** * 按照客户计算所有指标(按照月份) * * @param formDTO * @return com.epmet.commons.tools.utils.Result - * @Author zhangyong + * @Author zhangyongç * @Date 10:52 2020-08-20 **/ @ExternalAppRequestAuth @@ -80,34 +108,66 @@ public class IndexCalculateController { public Result indexCalculate(ExternalAppRequestParam externalAppRequestParam, @RequestBody CalculateCommonFormDTO formDTO) { String customerId = externalAppRequestParam.getCustomerId(); //String customerId = "epmettest"; - Boolean executing = (Boolean) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); - if (executing == null || !executing) { + formDTO.setCustomerId(customerId); + indexCalculate(formDTO); + return new Result().ok(true); + } + + /** + * 指标计算 + * @param formDTO + */ + private void indexCalculate(CalculateCommonFormDTO formDTO) { + CalculateFlagModel executeFlag = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + if (executeFlag == null || !CalculateStatus.CALCULATING.equals(executeFlag.getStatus())) { + // 可以计算 synchronized (statsCalLock) { - Boolean executing2 = (Boolean) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); - if (executing2 != null && executing2) { - log.error(String.format("该客户正在执行计算,请勿重复提交计算请求。", customerId)); - return new Result().ok(false); + CalculateFlagModel executingFlag2 = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + if (executingFlag2 != null && CalculateStatus.CALCULATING.equals(executingFlag2.getStatus())) { + //log.error(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", customerId)); + throw new RenException(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", formDTO.getCustomerId())); } - Future future = singleThreadPool.submit(() -> { - formDTO.setCustomerId(customerId); - long start = System.currentTimeMillis(); - Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); - if (aBoolean) { - log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); - } - redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); - futureMap.remove(customerId); - }); - futureMap.put(customerId, future); - redisUtils.set(RedisKeys.getCustomerStatsCalFlag(customerId), true); + // 提交异步计算 + submitCalculate(formDTO); } } else { - log.error(String.format("该客户正在执行计算,请勿重复提交计算请求。", customerId)); - return new Result().ok(false); + throw new RenException(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", formDTO.getCustomerId())); } + } + + /** + * 提交异步计算 + * @param formDTO + * @return + */ + private void submitCalculate(CalculateCommonFormDTO formDTO) { + Future future = singleThreadPool.submit(() -> { + long start = System.currentTimeMillis(); + Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); + if (aBoolean) { + log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000); + } + redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + futureMap.remove(formDTO.getCustomerId()); - return new Result().ok(true); + //测试代码 + //try { + // Thread.sleep(20000l); + // System.out.println(System.currentTimeMillis()); + //} catch (InterruptedException e) { + // e.printStackTrace(); + //} + //redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + //futureMap.remove(formDTO.getCustomerId()); + }); + + futureMap.put(formDTO.getCustomerId(), future); + + CalculateFlagModel flag = new CalculateFlagModel(); + flag.setStatus(CalculateStatus.CALCULATING); + flag.setForm(formDTO); + redisUtils.set(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()), flag); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java new file mode 100644 index 0000000000..95d114ae16 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java @@ -0,0 +1,20 @@ +package com.epmet.model; + +import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import lombok.Data; + +@Data +public class CalculateFlagModel { + + /** + * 提交计算时候的参数 + */ + private CalculateCommonFormDTO form; + + /** + * 计算状态 + * CalculateStatus.java + */ + private String status; + +} From fd0ffe0a4cd11540a32b57e7f479db407ecb56a1 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 14 Sep 2020 10:02:15 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E6=8C=87=E6=95=B0=20-=20=E5=B9=B4?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E8=AE=A1=E7=AE=97=EF=BC=8C=E4=B9=98=E4=BB=A5?= =?UTF-8?q?=E6=9D=83=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/screen/ScreenIndexDataMonthlyDao.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index b699ec7d6b..f192c1373c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -71,9 +71,9 @@ PARENT_ID parentId, ORG_NAME orgName, SUM(INDEX_TOTAL) / #{monthCount} as indexTotal, - SUM(PARTY_DEV_ABLITY) / #{monthCount} as partyDevAblity, - SUM(SERVICE_ABLITY) / #{monthCount} as serviceAblity, - SUM(GOVERN_ABLITY) / #{monthCount} as governAblity + SUM(PARTY_DEV_ABLITY * PARTY_DEV_WEIGHT) / #{monthCount} as partyDevAblity, + SUM(SERVICE_ABLITY * SERVICE_ABLITY_WEIGHT) / #{monthCount} as serviceAblity, + SUM(GOVERN_ABLITY * GOVERN_ABLITY_WEIGHT) / #{monthCount} as governAblity FROM screen_index_data_monthly WHERE DEL_FLAG = '0' AND YEAR_ID = #{yearId} From 8f507bbd3551b40325d91ec0b6ab5187437d3637 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 10:24:51 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E7=AE=97=E6=B3=95=20=E8=BF=94=E5=9B=9E=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/enums/EnvEnum.java | 1 + .../controller/IndexCalculateController.java | 8 ++-- .../batch/BatchScoreCalculator.java | 39 +------------------ .../stats/test/normalizing/DemoScoreCal.java | 9 +++++ 4 files changed, 15 insertions(+), 42 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java index 0c3f798318..ed782790e8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java @@ -11,6 +11,7 @@ import org.springframework.core.env.Environment; * @date 2020-07-03 11:14 **/ public enum EnvEnum { + LOCAL("local", "本地环境"), DEV("dev", "开发环境"), TEST("test", "体验环境"), PROD("prod", "生产环境"), diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 4cecf7f168..b7499bd76f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; @@ -24,10 +25,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -186,7 +184,7 @@ public class IndexCalculateController { future.cancel(true); redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); futureMap.remove(customerId); - HttpClientManager.getInstance().sendAlarmMsg(String.format("数据统计服务-中止计算成功,customerId:%s", customerId)); + HttpClientManager.getInstance().sendAlarmMsg(String.format(EnvEnum.getCurrentEnv().getName() + "数据统计服务-中止计算成功,customerId:%s", customerId)); } return new Result(); } @@ -195,7 +193,7 @@ public class IndexCalculateController { public Result calculateAll(@RequestBody CalculateCommonFormDTO formDTO) { long start = System.currentTimeMillis(); Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); - HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); + HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); if (aBoolean) { return new Result().ok(true); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index b0ee8fa0ad..1e049b17c7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -57,8 +57,8 @@ public class BatchScoreCalculator { for (SampleValue vo : indexValueVOs) { String sampleId = vo.getSampleId(); //归一后的值 - BigDecimal normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); - BigDecimal score = scoreCalculator.normalize(normalizeValue, weight).setScale(6, RoundingMode.HALF_UP); + BigDecimal normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); + BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); if (result == null) { @@ -78,40 +78,6 @@ public class BatchScoreCalculator { return scoreCountOfSamples; } - /** - * 执行计算,以样本的所有指标总得分 - * - * @param indexInputVOS - * @return - */ - public HashMap getScoreCountOfSampleId(List indexInputVOS) { - - // 每个样本的总得分 - HashMap scoreCountOfSamples = new HashMap<>(); - - for (IndexInputVO idx : indexInputVOS) { - // 每个指标循环一次 - List indexValueVOs = idx.getIndexValueVOs(); - BigDecimal weight = idx.getWeight(); - ScoreCalculator scoreCalculator = idx.getScoreCalculator(); - BigDecimal threshold = idx.getThreshold(); - - for (SampleValue vo : indexValueVOs) { - String sampleId = vo.getSampleId(); - BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight); - if (scoreCountOfSamples.containsKey(sampleId)) { - BigDecimal newScore = scoreCountOfSamples.get(sampleId).add(score).setScale(6, RoundingMode.HALF_UP); - scoreCountOfSamples.put(sampleId, newScore); - } else { - score.setScale(6, RoundingMode.HALF_UP); - scoreCountOfSamples.put(sampleId, score); - } - } - } - - return scoreCountOfSamples; - } - /** * 获取最终样本值 * @@ -128,5 +94,4 @@ public class BatchScoreCalculator { return (bdRealValue.compareTo(threshold) < 0) || (bdRealValue.equals(threshold)) ? bdRealValue : threshold; - } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index 15e029b3e6..37b70e5297 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java @@ -172,11 +172,20 @@ public class DemoScoreCal { BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); + System.err.println("----------------1----------------"); result.forEach((key, value) -> { System.out.println(key.concat("的得分为:").concat(value.toString())); }); System.err.println("-----------------2---------------"); + + + System.err.println("----------------123123123123----------------"); + result2.forEach((key, value) -> { + System.out.println(key.concat("的得分为:").concat(value.toString())); + }); + System.err.println("-----------------2---------------"); } From 174358f68f6e952a1e4107e6b3dab95541a318b7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 10:25:16 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E7=AE=97=E6=B3=95=20=E8=BF=94=E5=9B=9E=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/support/normalizing/batch/BatchScoreCalculator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 1e049b17c7..c439df6213 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -94,4 +94,5 @@ public class BatchScoreCalculator { return (bdRealValue.compareTo(threshold) < 0) || (bdRealValue.equals(threshold)) ? bdRealValue : threshold; + } } From 0243c686cb7a336842eb3a02bf54c3ef3d3ebc74 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 10:29:43 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=8E=92=E9=99=A4=E6=9C=AC=E5=9C=B0=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/aspect/CustomerApplicationRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java index 8e065c792a..4500453213 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java @@ -41,7 +41,7 @@ public class CustomerApplicationRunner implements ApplicationRunner { //发送启动成功消息 EnvEnum currentEnv = EnvEnum.getCurrentEnv(); logger.info(currentEnv); - if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode())) { + if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); From 406f3d20e98062d28d07653a196871617f915465 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 10:33:02 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/stats/test/normalizing/DemoScoreCal.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index 37b70e5297..e3681eab55 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java @@ -244,13 +244,8 @@ public class DemoScoreCal { BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); System.out.println("param:" + JSON.toJSONString(indexInputVOS)); - HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); - System.err.println("----------------1----------------"); - result.forEach((key, value) -> { - System.out.println(key.concat("的得分为:").concat(value.toString())); - }); System.err.println("-----------------2---------------"); System.err.println("----------------11111111----------------"); From b2d256764267fde2d689d00c6292664c1ffd59b6 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 14 Sep 2020 10:34:49 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/IndexCalculateController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index b7499bd76f..b9491f1cf2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -78,7 +78,7 @@ public class IndexCalculateController { * 处理暂停中的计算 */ @PostMapping("process-pendding-cals") - public void processPenddingCalculate() { + public Result processPenddingCalculate() { String keyPrefix = RedisKeys.getCustomerStatsCalKeyPrefix(); Set calFlagKeys = redisUtils.keys(keyPrefix.concat("*")); calFlagKeys.forEach(key -> { @@ -91,6 +91,8 @@ public class IndexCalculateController { indexCalculate(form); } }); + + return new Result(); } /** From cbe689e1dfcbb89622adb587c1bbb0dace084a5f Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 14 Sep 2020 10:42:16 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/stats/test/normalizing/DemoScoreCal.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index e3681eab55..16549e9b47 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java @@ -170,7 +170,7 @@ public class DemoScoreCal { List indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + HashMap result = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); From 0d2e1c7cb637ce619c349da70f2c54df4aff54a1 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 14 Sep 2020 10:47:25 +0800 Subject: [PATCH 14/23] =?UTF-8?q?/data/stats/kcscreencoll/news/trend=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=85=A5=E5=8F=82=E5=8E=BB=E6=8E=89readCount?= =?UTF-8?q?=EF=BC=8Cscreen=5Fkc=5Fnews=5Ftrend=5Fmonthly=E8=A1=A8=E5=8E=BB?= =?UTF-8?q?=E6=8E=89read=5Fcount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java | 5 ----- .../screen/ScreenKcNewsTrendMonthlyEntity.java | 5 ----- .../evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml | 3 --- 3 files changed, 13 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java index 6e6bdf9359..5d00324e55 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java @@ -15,11 +15,6 @@ public class KcNewsTrendFormDTO implements Serializable { private static final long serialVersionUID = 1L; - /** - * 阅读数量 - */ - private Integer readCount; - /** * 参与数量 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java index 548d34f284..d63a96ee08 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java @@ -48,11 +48,6 @@ public class ScreenKcNewsTrendMonthlyEntity extends BaseEpmetEntity { */ private String monthId; - /** - * 阅读数量 - */ - private Integer readCount; - /** * 参与数量 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml index 4caffe8fba..60bebaa7d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml @@ -7,7 +7,6 @@ - @@ -29,7 +28,6 @@ ID, CUSTOMER_ID, MONTH_ID, - READ_COUNT, PARTI_COUNT, DEL_FLAG, REVISION, @@ -43,7 +41,6 @@ (SELECT REPLACE(UUID(), '-', '') AS id), #{customerId}, #{monthId}, - #{item.readCount}, #{item.partiCount}, 0, 0, From c60bf5607027e8668e3dd7a1039e427fba67a7e4 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 14 Sep 2020 11:11:49 +0800 Subject: [PATCH 15/23] =?UTF-8?q?sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/CustomerStaffDao.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 48fd117891..4d88329d42 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -230,9 +230,11 @@ cs.del_flag = 0 AND cs.enable_flag = 'enable' AND - - cs.user_id = #{userId} - + ( + + cs.user_id = #{userId} + + ) From bfa0bca4766c800edb0737c24b606d1b8bd0c116 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 14 Sep 2020 13:54:05 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E7=9A=84=E7=BB=9F=E8=AE=A1=EF=BC=8C=E9=87=8D=E6=96=B0=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/DataStatisticalOpenFeignClient.java | 7 +++++ ...ataStatisticalOpenFeignClientFallBack.java | 5 ++++ .../DataStatsProcessPenddingCalService.java | 9 +++++++ ...ataStatsProcessPenddingCalServiceImpl.java | 19 ++++++++++++++ .../task/DataStatsProcessPenddingCalTask.java | 26 +++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index 1f1c1b10fe..107bc8f478 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -173,4 +173,11 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/statstopic/execute") Result execTopicStatistical(@RequestParam(value = "date",required = false) String date); + /** + * 处理暂停的计算 + * @return + */ + @PostMapping("/data/stats/indexcalculate/process-pendding-cals") + Result processPenddingCalculate(); + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index d58fa69ec4..1c79cfc56b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -170,4 +170,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result execTopicStatistical(String date) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execTopicStatistical",date); } + + @Override + public Result processPenddingCalculate() { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "processPenddingCalculate"); + } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java new file mode 100644 index 0000000000..9b5d049284 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java @@ -0,0 +1,9 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +public interface DataStatsProcessPenddingCalService { + + Result processPenddingCal(); + +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java new file mode 100644 index 0000000000..55381b40b0 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java @@ -0,0 +1,19 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.DataStatsProcessPenddingCalService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class DataStatsProcessPenddingCalServiceImpl implements DataStatsProcessPenddingCalService { + + @Autowired + private DataStatisticalOpenFeignClient feignClient; + + @Override + public Result processPenddingCal() { + return feignClient.processPenddingCalculate(); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java new file mode 100644 index 0000000000..b02396846c --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java @@ -0,0 +1,26 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.DataStatsProcessPenddingCalService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("dataStatsProcessPenddingCalTask") +public class DataStatsProcessPenddingCalTask implements ITask { + + @Autowired + private DataStatsProcessPenddingCalService dataStatsProcessPenddingCalService; + + @Override + public void run(String params) { + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行,参数为:{}", params); + Result result = dataStatsProcessPenddingCalService.processPenddingCal(); + if (result.success()){ + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行定时任务执行成功"); + }else { + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} From 80c0e6c2d22007aa6c418eb31162a0990ff0fa6c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 14 Sep 2020 14:43:10 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E5=AD=94=E6=9D=91-=E9=A6=96=E9=A1=B5-?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=90=84=E7=B1=BB=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/result/SummaryResultDTO.java | 71 +++++++++++++++++++ .../controller/screen/KcScreenController.java | 22 ++++-- .../ScreenKcPlatformSummaryDailyDao.java | 7 ++ .../screen/KcScreenService.java | 9 +++ .../screen/impl/KcScreenServiceImpl.java | 14 ++++ .../ScreenKcPlatformSummaryDailyDao.xml | 24 +++++++ 6 files changed, 140 insertions(+), 7 deletions(-) create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java new file mode 100644 index 0000000000..13457e175f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java @@ -0,0 +1,71 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 首页-平台各类总数 + * @Author sun + */ +@Data +public class SummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 数据更新至:yyyyMMdd + */ + private String dateId = ""; + + /** + * 网格总数 + */ + private Integer gridCount = 0; + /** + * 已开通网格数 + */ + private Integer openedGridCount = 0; + /** + * 议题总数 + */ + private Integer issueCount = 0; + /** + * 项目总数 + */ + private Integer projectCount = 0; + /** + * 用户总数 + */ + private Integer userCount = 0; + /** + * 党员用户 + */ + private Integer partyUserCount = 0; + /** + * 社群总数 + */ + private Integer groupCount = 0; + /** + * 话题总数 + */ + private Integer topicCount = 0; + /** + * 新闻总数 + */ + private Integer newsCount = 0; + /** + * 阅读数量 + */ + private Integer readCount = 0; + /** + * 公益活动总数 + */ + private Integer actCount = 0; + /** + * 志愿者总数 + */ + private Integer volunteerCount = 0; + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index eb28cd5270..3792593909 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -1,7 +1,12 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.utils.Result; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; +import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -19,12 +24,15 @@ public class KcScreenController { private KcScreenService kcScreenService; -// @ExternalAppRequestAuth -// @PostMapping("homepage/summary") -// public Result yearAverageIndex(){ -//// ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class); -//// return new Result().ok(indexService.yearAverageIndex(yearAverageIndexFormDTO)); -// } + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("homepage/summary") + public Result summary(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.summary(externalAppRequestParam)); + } - // @RequestBody } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java index 04c0d5dec9..cfa086ebcf 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -28,4 +29,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcPlatformSummaryDailyDao { + /** + * @param customerId + * @Description 首页-平台各类总数 + * @author sun + */ + SummaryResultDTO selectSummaryDaily(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index e079aefb42..22ee78e1ff 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -1,5 +1,8 @@ package com.epmet.datareport.service.evaluationindex.screen; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; + /** * 孔村大屏api * @@ -8,5 +11,11 @@ package com.epmet.datareport.service.evaluationindex.screen; */ public interface KcScreenService { + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + SummaryResultDTO summary(ExternalAppRequestParam externalAppRequestParam); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index a7f656884b..17b445cac4 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -1,9 +1,12 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcPlatformSummaryDailyDao; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; import com.epmet.datareport.utils.DateUtils; +import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +22,17 @@ public class KcScreenServiceImpl implements KcScreenService { @Autowired private DateUtils dateUtils; + @Autowired + private ScreenKcPlatformSummaryDailyDao screenKcPlatformSummaryDailyDao; + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + @Override + public SummaryResultDTO summary(ExternalAppRequestParam externalAppRequestParam) { + return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId()); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml index 1618b51341..c2b7789b5a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml @@ -3,5 +3,29 @@ + From 8c0e505c4cf3e70bfaf8d2161d2010d6a9784323 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 14 Sep 2020 14:53:31 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ummaryResultDTO.java => HomepageSummaryResultDTO.java} | 2 +- .../datareport/controller/screen/KcScreenController.java | 8 +++++--- .../screenkc/ScreenKcPlatformSummaryDailyDao.java | 4 ++-- .../service/evaluationindex/screen/KcScreenService.java | 4 ++-- .../evaluationindex/screen/impl/KcScreenServiceImpl.java | 4 ++-- .../mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) rename epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/{SummaryResultDTO.java => HomepageSummaryResultDTO.java} (94%) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java similarity index 94% rename from epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java index 13457e175f..cbecba012c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SummaryResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java @@ -9,7 +9,7 @@ import java.io.Serializable; * @Author sun */ @Data -public class SummaryResultDTO implements Serializable { +public class HomepageSummaryResultDTO implements Serializable { private static final long serialVersionUID = 3860268744336541373L; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index 3792593909..84ae37ba49 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -4,7 +4,7 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; -import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -31,8 +31,10 @@ public class KcScreenController { */ @ExternalAppRequestAuth @PostMapping("homepage/summary") - public Result summary(ExternalAppRequestParam externalAppRequestParam){ - return new Result().ok(kcScreenService.summary(externalAppRequestParam)); + public Result homepageSummary(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.homepageSummary(externalAppRequestParam)); } + + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java index cfa086ebcf..44ac5c506a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java @@ -17,7 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; -import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -34,5 +34,5 @@ public interface ScreenKcPlatformSummaryDailyDao { * @Description 首页-平台各类总数 * @author sun */ - SummaryResultDTO selectSummaryDaily(String customerId); + HomepageSummaryResultDTO selectSummaryDaily(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index 22ee78e1ff..661d09bcbe 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -1,7 +1,7 @@ package com.epmet.datareport.service.evaluationindex.screen; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; -import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; /** * 孔村大屏api @@ -16,6 +16,6 @@ public interface KcScreenService { * @Description 首页-平台各类总数 * @author sun */ - SummaryResultDTO summary(ExternalAppRequestParam externalAppRequestParam); + HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index 17b445cac4..7bc58b9cc5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -6,7 +6,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcPlatformSummaryDailyDao; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; import com.epmet.datareport.utils.DateUtils; -import com.epmet.evaluationindex.screen.dto.result.SummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -31,7 +31,7 @@ public class KcScreenServiceImpl implements KcScreenService { * @author sun */ @Override - public SummaryResultDTO summary(ExternalAppRequestParam externalAppRequestParam) { + public HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam) { return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId()); } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml index c2b7789b5a..1b2818d77c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml @@ -3,7 +3,7 @@ - SELECT date_id AS "dateId", grid_count AS "gridCount", From 650736038c03ff033069cc76ab51e84c97324d45 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 14 Sep 2020 15:18:36 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E4=B8=89=E5=A4=A7=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E4=B9=98=E4=B8=8A=E5=AF=B9=E5=BA=94=E6=9D=83=E9=87=8D=EF=BC=8C?= =?UTF-8?q?=E5=9B=9B=E8=88=8D=E4=BA=94=E5=85=A5=E6=8F=90=E5=87=BA=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/IndexServiceImpl.java | 55 ++++++++++++++++--- .../screen/ScreenIndexDataMonthlyDao.xml | 30 +++++----- .../screen/ScreenIndexDataYearlyDao.xml | 8 +-- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index e3e6ce4a61..b0c9715031 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.Comparator; @@ -53,6 +54,10 @@ public class IndexServiceImpl implements IndexService { if (null == yearAverageIndexResultDTO){ return new YearAverageIndexResultDTO(); } + yearAverageIndexResultDTO.setPartyDevAbility(getRound(yearAverageIndexResultDTO.getPartyDevAbility())); + yearAverageIndexResultDTO.setGovernAbility(getRound(yearAverageIndexResultDTO.getGovernAbility())); + yearAverageIndexResultDTO.setServiceAbility(getRound(yearAverageIndexResultDTO.getServiceAbility())); + yearAverageIndexResultDTO.setYearAverageIndex(getRound(yearAverageIndexResultDTO.getYearAverageIndex())); return yearAverageIndexResultDTO; } @@ -66,19 +71,23 @@ public class IndexServiceImpl implements IndexService { @Override public MonthPieChartResultDTO monthPieChart(MonthPieChartFormDTO monthPieChartFormDTO) { - MonthPieChartResultDTO monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),null); + MonthPieChartResultDTO pieChartDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),null); + if (null == pieChartDTO){ + return new MonthPieChartResultDTO(); + } + // 处理小数四舍五入 + pieChartDTO.setPartyDevAbility(getRound(pieChartDTO.getPartyDevAbility())); + pieChartDTO.setGovernAbility(getRound(pieChartDTO.getGovernAbility())); + pieChartDTO.setServiceAbility(getRound(pieChartDTO.getServiceAbility())); String monthId = dateUtils.getCurrentMonthId(); int time = NumConstant.TWELVE; //保证获取月度指数数据的最大可能性 - while(null == monthPieChartResultDTO && time > NumConstant.ONE){ + while(null == pieChartDTO && time > NumConstant.ONE){ time--; monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); - monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),monthId); + pieChartDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),monthId); } - if (null == monthPieChartResultDTO){ - return new MonthPieChartResultDTO(); - } - return monthPieChartResultDTO; + return pieChartDTO; } /** @@ -112,6 +121,13 @@ public class IndexServiceImpl implements IndexService { result.setTotalIndexData(totalIndexData); return result; } + // 处理小数四舍五入 + monthBarchartResults.forEach(barchart -> { + barchart.setPartyDevAbility(getRound(barchart.getPartyDevAbility())); + barchart.setGovernAbility(getRound(barchart.getGovernAbility())); + barchart.setServiceAbility(getRound(barchart.getServiceAbility())); + barchart.setIndexTotal(getRound(barchart.getIndexTotal())); + }); List collect = monthBarchartResults.stream().sorted(Comparator.comparing(MonthBarchartResult::getMonthId)).collect(Collectors.toList()); //升序 当前月份在队尾 List _ymList = dateUtils.getXpro().keySet().stream().collect(Collectors.toList()); @@ -178,6 +194,13 @@ public class IndexServiceImpl implements IndexService { if (CollectionUtils.isEmpty(subAgencyIndexRankResultDTOS)){ return new ArrayList<>(); } + // 小数四舍五入 + subAgencyIndexRankResultDTOS.forEach(indexRank -> { + indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility())); + indexRank.setGovernAbility(getRound(indexRank.getGovernAbility())); + indexRank.setServiceAbility(getRound(indexRank.getServiceAbility())); + indexRank.setTotalIndex(getRound(indexRank.getTotalIndex())); + }); return subAgencyIndexRankResultDTOS; } @@ -191,7 +214,25 @@ public class IndexServiceImpl implements IndexService { } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())){ // 月(上一个月) 指数排行 subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectAnNingSubAgencyIndexMonthlyRank(formDTO); + subAgencyIndexRankResultDTOS.forEach(rank -> { + rank.setPartyDevAbility(getRound(rank.getPartyDevAbility())); + rank.setGovernAbility(getRound(rank.getGovernAbility())); + rank.setServiceAbility(getRound(rank.getServiceAbility())); + rank.setTotalIndex(getRound(rank.getTotalIndex())); + }); } return subAgencyIndexRankResultDTOS; } + + /** + * @Description 小数四舍五入 + * @param d + * @author zxc + * @date 2020/9/14 2:01 下午 + */ + public Double getRound(Double d){ + BigDecimal bigDecimal = new BigDecimal(d); + BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP); + return Double.valueOf(b.toString()); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index 58a41b9d5f..0a040c2ccb 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -6,9 +6,9 @@ SELECT month_id AS monthId, - ROUND(service_ablity,1) AS serviceAbility, - ROUND(party_dev_ablity,1) AS partyDevAbility, - ROUND(govern_ablity,1) AS governAbility, - ROUND(index_total,1) AS indexTotal + service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility, + party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility, + govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility, + (service_ablity * SERVICE_ABLITY_WEIGHT + party_dev_ablity * PARTY_DEV_WEIGHT + govern_ablity * GOVERN_ABLITY_WEIGHT) AS indexTotal FROM screen_index_data_monthly WHERE @@ -47,10 +47,10 @@ SELECT - ROUND(index_total,1) AS yearAverageIndex, - ROUND(service_ablity,1) AS serviceAbility, - ROUND(party_dev_ablity,1) AS partyDevAbility, - ROUND(govern_ablity,1) AS governAbility + index_total AS yearAverageIndex, + service_ablity AS serviceAbility, + party_dev_ablity AS partyDevAbility, + govern_ablity AS governAbility FROM screen_index_data_yearly WHERE From 02a48a1965200963040b669d1ee02dde3760442c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 14 Sep 2020 18:02:41 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E5=AD=94=E6=9D=91=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/ActTrendMonthlyResultDTO.java | 26 ++++++++++ .../result/HeartActcounttrendResultDTO.java | 29 +++++++++++ .../dto/result/HeartSummaryResultDTO.java | 43 ++++++++++++++++ .../controller/screen/KcScreenController.java | 22 +++++++++ .../screenkc/ScreenKcActTrendMonthlyDao.java | 9 ++++ ...ScreenKcVolunteerHeatRankGridDailyDao.java | 7 +++ .../screen/KcScreenService.java | 15 ++++++ .../screen/impl/KcScreenServiceImpl.java | 49 ++++++++++++++++++- .../screenkc/ScreenKcActTrendMonthlyDao.xml | 15 +++++- .../ScreenKcVolunteerHeatRankGridDailyDao.xml | 17 +++++++ 10 files changed, 229 insertions(+), 3 deletions(-) create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java new file mode 100644 index 0000000000..80019a15c4 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 公益互助-公益活动次数 + * @Author sun + */ +@Data +public class ActTrendMonthlyResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 月id :yyyyMM + */ + private String monthId = ""; + + /** + * 活动数量(本月举行的活动) + */ + private Integer actCount = 0; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java new file mode 100644 index 0000000000..4ebc3422d0 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; +import rx.internal.util.LinkedArrayList; + +import java.io.Serializable; +import java.util.LinkedList; + +/** + * 公益互助-公益活动次数 + * @Author sun + */ +@Data +public class HeartActcounttrendResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 横坐标 月份集合 + */ + private LinkedList xAxis; + + /** + * 活动次数 集合 + */ + private LinkedList actCountDataList; + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java new file mode 100644 index 0000000000..a91482cebe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 公益互助-各类总数汇总 + * @Author sun + */ +@Data +public class HeartSummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 日期Id, 数据更新至:yyyyMMdd + */ + private String dateId = ""; + + /** + * 活动次数 + */ + private Integer actCount = 0; + /** + * 志愿者总数 + */ + private Integer volunteerCount = 0; + /** + * 参与人次 + */ + private Integer partiUserCount = 0; + /** + * 发放积分 + */ + private Integer rewardPointCount = 0; + /** + * 公益时长 + */ + private Integer heartTime = 0; + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index 84ae37ba49..88a9a425bd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -4,6 +4,8 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -35,6 +37,26 @@ public class KcScreenController { return new Result().ok(kcScreenService.homepageSummary(externalAppRequestParam)); } + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("heart/summary") + public Result heartSummary(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.heartSummary(externalAppRequestParam)); + } + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("heart/actcounttrend") + public Result heartActcounttrend(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.heartActcounttrend(externalAppRequestParam)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java index 052febf324..bb7cdaad84 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java @@ -17,8 +17,11 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.ActTrendMonthlyResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * KC-活动(次数+时长)趋势(先根据customerId+monthId删除) * @@ -28,4 +31,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcActTrendMonthlyDao { + /** + * @param customerId + * @Description 按客户查询最近十二个月数据 + * @author sun + */ + List selectActTrendMonthly(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java index 91bd730689..64ef74f376 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -28,4 +29,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcVolunteerHeatRankGridDailyDao { + /** + * @param customerId + * @Description 公益互助-各类总数汇总 + * @author sun + */ + HeartSummaryResultDTO selectHeartSummary(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index 661d09bcbe..0e58cf7c08 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -1,6 +1,8 @@ package com.epmet.datareport.service.evaluationindex.screen; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; /** @@ -18,4 +20,17 @@ public interface KcScreenService { */ HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam); + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam); + + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index 7bc58b9cc5..02b2c9c02d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -3,13 +3,21 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcActTrendMonthlyDao; import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcPlatformSummaryDailyDao; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcVolunteerHeatRankGridDailyDao; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; import com.epmet.datareport.utils.DateUtils; +import com.epmet.evaluationindex.screen.dto.result.ActTrendMonthlyResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.LinkedList; +import java.util.List; + /** * 孔村大屏api * @@ -24,10 +32,14 @@ public class KcScreenServiceImpl implements KcScreenService { private DateUtils dateUtils; @Autowired private ScreenKcPlatformSummaryDailyDao screenKcPlatformSummaryDailyDao; + @Autowired + private ScreenKcVolunteerHeatRankGridDailyDao screenKcVolunteerHeatRankGridDailyDao; + @Autowired + private ScreenKcActTrendMonthlyDao screenKcActTrendMonthlyDao; /** - * @param externalAppRequestParam - * @Description 首页-平台各类总数 + * @param externalAppRequestParam + * @Description 首页-平台各类总数 * @author sun */ @Override @@ -35,4 +47,37 @@ public class KcScreenServiceImpl implements KcScreenService { return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId()); } + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + @Override + public HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam) { + return screenKcVolunteerHeatRankGridDailyDao.selectHeartSummary(externalAppRequestParam.getCustomerId()); + } + + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + @Override + public HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam) { + HeartActcounttrendResultDTO resultDTO = new HeartActcounttrendResultDTO(); + LinkedList xAxis = new LinkedList<>(); + LinkedList actCountDataList = new LinkedList<>(); + //1.按客户查询最近十二个月数据 + List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId()); + //2.倒序遍历封装数据 + for (int i = list.size() - 1; i >= 0; i--) { + xAxis.add(list.get(i).getMonthId()); + actCountDataList.add(list.get(i).getActCount().toString()); + } + //3.封装数据并返回 + resultDTO.setXAxis(xAxis); + resultDTO.setActCountDataList(actCountDataList); + return resultDTO; + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml index 5978feed5a..55b9bca50a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml @@ -4,5 +4,18 @@ - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml index 4c6ff538f8..581f4a013e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml @@ -4,4 +4,21 @@ + From a7ebeffb70d81526bb59e42396275fd9877dee74 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 15 Sep 2020 09:07:03 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E5=AD=94=E6=9D=91=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=A4=96=E9=83=A8=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V0.0.7__add_kongcun_app.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql new file mode 100644 index 0000000000..5114b07688 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql @@ -0,0 +1,9 @@ +INSERT INTO `epmet_common_service`.`external_customer`(`ID`, `CUSTOMER_NAME`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2fe0065f70ca0e23ce4c26fca5f1d933', '大美孔村', 0, 0, 'APP_USER', '2020-09-15 09:00:57', 'APP_USER', '2020-09-15 09:00:57'); + + +INSERT INTO `epmet_common_service`.`external_app`(`ID`, `APP_NAME`, `CUSTOMER_ID`, `CUSTOMER_TYPE`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `DEL_FLAG`) VALUES ('4733fda58aba5024b776f22f135350df', '孔村数据采集', '2fe0065f70ca0e23ce4c26fca5f1d933', 'external', 0, 'APP_USER', '2020-09-15 09:01:31', 'APP_USER', '2020-09-15 09:01:31', 0); +INSERT INTO `epmet_common_service`.`external_app`(`ID`, `APP_NAME`, `CUSTOMER_ID`, `CUSTOMER_TYPE`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `DEL_FLAG`) VALUES ('5efcfb775125d656f39583b8110a3d7d', '孔村大屏', '2fe0065f70ca0e23ce4c26fca5f1d933', 'external', 0, 'APP_USER', '2020-09-15 09:01:39', 'APP_USER', '2020-09-15 09:01:39', 0); + + +INSERT INTO `epmet_common_service`.`external_app_secret`(`ID`, `APP_ID`, `SECRET`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('362d4fce3311f67edb40b0e5291d37eb', '5efcfb775125d656f39583b8110a3d7d', '657cd46d385a4c2ba6d9355aee24654ac3951deab7e6436e91201561b94969b5', 0, 0, 'APP_USER', '2020-09-15 09:01:39', 'APP_USER', '2020-09-15 09:01:39'); +INSERT INTO `epmet_common_service`.`external_app_secret`(`ID`, `APP_ID`, `SECRET`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('7853487c79dab384b4c681d734d9eb3a', '4733fda58aba5024b776f22f135350df', '61224b4d747f4853b9551fe078b90b2355f72c3256a14bdb8faac4a4d7ed68a0', 0, 0, 'APP_USER', '2020-09-15 09:01:31', 'APP_USER', '2020-09-15 09:01:31'); From 8b3436d42985ed5f999fe48a5ec7e53b4a475fce Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 15 Sep 2020 09:38:29 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=BA=90=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/dynamic/datasource/config/DynamicDataSource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java index 48512ed7af..c094c1fa69 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java @@ -24,7 +24,9 @@ public class DynamicDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { - return DynamicContextHolder.peek(); + String ds = DynamicContextHolder.peek(); + System.out.println("动态数据源:" + ds); + return ds; } } From 21f7d96164bfd6a786132234dc692f37965d67c1 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 15 Sep 2020 09:39:11 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=BA=90=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/dynamic/datasource/config/DynamicDataSource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java index c094c1fa69..62939c595f 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java @@ -25,7 +25,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { String ds = DynamicContextHolder.peek(); - System.out.println("动态数据源:" + ds); + logger.info("动态数据源:{}" + ds); return ds; }