From 9fe57ebb8c745813543489cbcf7a9a2c82b639f0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Oct 2020 15:00:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?screen=5Findex=5Fdata=5Fmonthly=E8=A1=A8?= =?UTF-8?q?=E9=87=8C=E7=BC=BA=E5=B0=91=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcoll/impl/FactIndexCollectServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 640698d058..83ad985174 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -204,6 +204,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } } + /** + * @Description 目前只支持到区县级别,区县级以上的未实现 + * @Param monthId + * @Param customerId + * @author zxc + * @date 2020/10/20 2:59 下午 + */ @Override public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) { if (NumConstant.SIX != monthId.length()) { From cb8d5497e009302a964089ded3e1ce85cef17278 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Oct 2020 17:43:45 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=99=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/commons/tools/constant/NumConstant.java | 1 + .../epmet/support/normalizing/batch/BatchScoreCalculator.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 75c8c1cac9..01af04ae04 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -39,6 +39,7 @@ public interface NumConstant { int SIXTY = 60; int ONE_HUNDRED = 100; BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); + BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; int MAX = 99999999; int EIGHTY_EIGHT = 88; 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 cfa2dc941f..900b15aaf5 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 @@ -1,6 +1,7 @@ package com.epmet.support.normalizing.batch; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.support.normalizing.BigDecimalScoreCalculator; import com.epmet.support.normalizing.Correlation; import com.epmet.support.normalizing.ScoreCalculator; @@ -79,6 +80,7 @@ public class BatchScoreCalculator { }else { //如果不需要归一 则 直接value*权重 if (idx.isScore()) { + vo.setSampleValue(new BigDecimal(vo.getSampleValue().toString()).compareTo(NumConstant.ZERO_DECIMAL) == NumConstant.ZERO ? ScoreConstants.MIN_SCORE : new BigDecimal(vo.getSampleValue().toString())); normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); } else { normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); From 3884978e90446daba3352d0f611b0e7ecdc0e41c Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 20 Oct 2020 17:50:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=BD=92=E4=B8=80=E5=8C=BA=E9=97=B4=20?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/support/normalizing/ScoreConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java index 28a24f7a14..599e566540 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java @@ -3,7 +3,7 @@ package com.epmet.support.normalizing; import java.math.BigDecimal; /** - * 分值常量 + * 分值常量 归一区间 */ public class ScoreConstants { From 2920d759a7f3ce9da986dee6a3a371c6514c39b7 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Oct 2020 17:54:06 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/resources/数据值略小时可能的情况.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt new file mode 100644 index 0000000000..b317962bea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt @@ -0,0 +1,3 @@ +1. 当数据偏小时,可能社区下没有网格,例如 网格发文数量得分就为0; +2. screen_index_data_monthly中的 数据条数 与客户下(组织数 + 直属部门数 + 网格数)的和不统一, + 原因:数据插入的时候,只算到了区县级,区县级以上的没有计算,少了 市级和省级agency \ No newline at end of file From 284e16f34cc14b0b5cd1de00d13e9083ba5e4cbf Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 20 Oct 2020 17:57:35 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/resources/数据值略小时可能的情况.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt index b317962bea..cb778584e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据值略小时可能的情况.txt @@ -1,3 +1,7 @@ 1. 当数据偏小时,可能社区下没有网格,例如 网格发文数量得分就为0; 2. screen_index_data_monthly中的 数据条数 与客户下(组织数 + 直属部门数 + 网格数)的和不统一, - 原因:数据插入的时候,只算到了区县级,区县级以上的没有计算,少了 市级和省级agency \ No newline at end of file + 原因:数据插入的时候,只算到了区县级,区县级以上的没有计算,少了 市级和省级agency + +文档地址: + 1. 大屏指标项文档说明:https://www.kdocs.cn/view/l/svtSfaUyzNYZ?f=130 + 2. 大屏或手机端:https://www.kdocs.cn/view/l/suilmk0Ziss1?f=130 \ No newline at end of file From f2428906e944bb9781edfe213c7e772be3b0702e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 21 Oct 2020 10:20:42 +0800 Subject: [PATCH 6/6] =?UTF-8?q?dimPartyMember=E4=BF=A1=E6=81=AF=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=B7=BB=E5=8A=A0=E6=8C=87=E5=AE=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8C=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/CustomerIdAndDateIdFormDTO.java | 5 +- .../com/epmet/controller/DimController.java | 1 - .../DimCustomerPartymemberServiceImpl.java | 63 +++++++++++-------- .../impl/DimPartyMemberServiceImpl.java | 16 ++--- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/CustomerIdAndDateIdFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/CustomerIdAndDateIdFormDTO.java index 820d3a5447..e811c0aea0 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/CustomerIdAndDateIdFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/CustomerIdAndDateIdFormDTO.java @@ -19,6 +19,9 @@ public class CustomerIdAndDateIdFormDTO implements Serializable { private String customerId; - @NotBlank(message = "日期Id不能为空",groups = CustomerIdAndDateId.class) private String dateId; + + private String startDate; + + private String endDate; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 8796c77d71..3e2a78b716 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -263,7 +263,6 @@ public class DimController { */ @PostMapping("statsparty") public Result getPartyInfo(@RequestBody CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO) { - ValidatorUtils.validateEntity(customerIdAndDateIdFormDTO, CustomerIdAndDateIdFormDTO.CustomerIdAndDateId.class); return new Result().ok(partyMemberService.statsPartyMember(customerIdAndDateIdFormDTO)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java index 0b0e1fa1ae..4215c1fe59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java @@ -41,6 +41,7 @@ import com.epmet.service.partymember.PartyMemberService; import com.epmet.service.stats.DimCustomerPartymemberService; import com.epmet.service.stats.DimCustomerService; import com.epmet.service.stats.DimGridService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -49,10 +50,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -134,32 +132,45 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl allCustomerId = dimCustomerService.getAllCustomerId(); - if (CollectionUtils.isEmpty(allCustomerId)){ + String customerIdOne = customerIdAndDateIdFormDTO.getCustomerId(); + List customerIds = new ArrayList<>(); + List dateIds = new ArrayList<>(); + if (StringUtils.isNotBlank(customerIdOne)){ + customerIds.add(customerIdOne); + }else { + customerIds = dimCustomerService.getAllCustomerId(); + } + if (CollectionUtils.isEmpty(customerIds)){ throw new RenException(StatsConstant.CUSTOMER_INFO_NULL); } - allCustomerId.forEach(customerId -> { - String dateId = customerIdAndDateIdFormDTO.getDateId(); - List partyMemberList = partyMemberService.selectPartyMemberInfo(customerId, dateId); - if (CollectionUtils.isEmpty(partyMemberList)){ - log.warn(String.format(StatsConstant.PARTY_INFO_LIST,customerId)); - return; - } - List gridIds = partyMemberList.stream().map(party -> party.getGridId()).distinct().collect(Collectors.toList()); - List agencyInfos = dimGridService.selectGridBelongAgencyInfo(gridIds); - TimeListResultDTO timeList = DateUtils.getTimeList(dateId); - partyMemberList.forEach(party -> { - BeanUtils.copyProperties(timeList,party); - agencyInfos.forEach(agency -> { - if (party.getGridId().equals(agency.getGridId())){ - party.setAgencyId(agency.getAgencyId()); - party.setParentId(agency.getParentId()); - party.setPids(agency.getPids()); - } + if ((StringUtils.isBlank(customerIdAndDateIdFormDTO.getStartDate()) && StringUtils.isBlank(customerIdAndDateIdFormDTO.getEndDate()))){ + dateIds.add(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1))); + }else { + dateIds = DateUtils.getDaysBetween(customerIdAndDateIdFormDTO.getStartDate(), customerIdAndDateIdFormDTO.getEndDate()); + } + List finalDateIds = dateIds; + customerIds.forEach(customerId -> { + finalDateIds.forEach(dateId -> { + List partyMemberList = partyMemberService.selectPartyMemberInfo(customerId, dateId); + if (CollectionUtils.isEmpty(partyMemberList)){ + log.warn(String.format(StatsConstant.PARTY_INFO_LIST,customerId)); + return; + } + List gridIds = partyMemberList.stream().map(party -> party.getGridId()).distinct().collect(Collectors.toList()); + List agencyInfos = dimGridService.selectGridBelongAgencyInfo(gridIds); + TimeListResultDTO timeList = DateUtils.getTimeList(dateId); + partyMemberList.forEach(party -> { + BeanUtils.copyProperties(timeList,party); + agencyInfos.forEach(agency -> { + if (party.getGridId().equals(agency.getGridId())){ + party.setAgencyId(agency.getAgencyId()); + party.setParentId(agency.getParentId()); + party.setPids(agency.getPids()); + } + }); }); + delAndInsertParty(partyMemberList,customerId,dateId); }); - delAndInsertParty(partyMemberList,customerId,dateId); }); return true; } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java index 2fc5ea1378..ca4d773f2a 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimPartyMemberServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.service.impl; -import com.alibaba.druid.util.StringUtils; -import com.epmet.commons.tools.constant.NumConstant; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; @@ -23,15 +22,8 @@ public class DimPartyMemberServiceImpl implements DimPartyMemberService { @Override - public Result getPartyInfo(String dateId) { - CustomerIdAndDateIdFormDTO c = new CustomerIdAndDateIdFormDTO(); - if (!StringUtils.isEmpty(dateId)) { - c.setDateId(dateId); - }else { - String now = LocalDate.now().minusDays(NumConstant.ONE).toString(); - String concat = now.substring(NumConstant.ZERO, NumConstant.FOUR).concat(now.substring(NumConstant.FIVE, NumConstant.SEVEN)).concat(now.substring(NumConstant.EIGHT, NumConstant.TEN)); - c.setDateId(concat); - } - return statsFeignClient.getPartyInfo(c); + public Result getPartyInfo(String form) { + CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO = JSON.parseObject(form, CustomerIdAndDateIdFormDTO.class); + return statsFeignClient.getPartyInfo(customerIdAndDateIdFormDTO); } }