From fb65e8c09bdde2d5485027fdbe3be5630f88ba59 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 23 Sep 2020 10:51:50 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E8=AF=9D=E9=A2=98=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=BD=E5=8F=96=E6=B7=BB=E5=8A=A0pids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/org/GridInfoDTO.java | 5 +++++ .../extract/FactOriginTopicLogDailyEntity.java | 5 ++++- .../extract/FactOriginTopicMainDailyEntity.java | 8 ++++---- .../todata/impl/FactOriginTopicMainDailyServiceImpl.java | 6 ++++-- .../extract/FactOriginTopicLogDailyDao.xml | 6 ++++-- .../extract/FactOriginTopicMainDailyDao.xml | 6 ++++-- .../src/main/resources/mapper/org/CustomerGridDao.xml | 3 ++- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java index 894e6e3d7d..991a132d09 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java @@ -32,4 +32,9 @@ public class GridInfoDTO implements Serializable { * 客户id */ private String customerId; + + /** + * 所有上级组织ID,英文:隔开 + */ + private String pids; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java index a1da41988a..4cfdce2cb8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java @@ -112,5 +112,8 @@ public class FactOriginTopicLogDailyEntity extends BaseEpmetEntity { * 原始业务发生时间 */ private Date originalBusinessTime; - + /** + * 所有上级组织ID,英文:隔开 + */ + private String pids; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java index 39e5304527..e9b88a2fe8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity.evaluationindex.extract; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 话题主表_日统计 * @@ -102,5 +99,8 @@ public class FactOriginTopicMainDailyEntity extends BaseEpmetEntity { * 话题发布人是否是党员:1是党员0不是。 默认0 */ private Boolean createTopicUserIsParty; - + /** + * 所有上级组织ID,英文:隔开 + */ + private String pids; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java index fc124d4964..9a32629526 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java @@ -173,7 +173,8 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl ( @@ -61,7 +62,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.pids} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml index 400c1715fa..6ca12b2229 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -35,7 +35,8 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + PIDS ) values ( @@ -58,7 +59,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.pids} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index c12feef84b..d1d1b9c5f4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -74,7 +74,8 @@ cg.ID as GRID_ID, cg.PID as AGENCY_ID, ca.PID AS PID, - CG.CUSTOMER_ID + CG.CUSTOMER_ID, + cg.PIDS FROM customer_grid cg LEFT JOIN customer_agency ca ON ( cg.PID = CA.ID ) From 5a1c555f5be3724a6c3ad107868f53bd01c3bbf8 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 23 Sep 2020 10:55:34 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E6=8D=95=E8=8E=B7=E8=B7=9F=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/AgencyServiceImpl.java | 19 ++- .../FactIndexCommunitySelfSubScoreDao.java | 4 +- .../FactIndexGridSelfSubScoreDao.java | 4 +- ...ity.java => AgencySelfSubScoreEntity.java} | 25 ++-- ....java => CommunitySelfSubScoreEntity.java} | 123 +++++++++--------- .../FactIndexGridSelfSubScoreEntity.java | 100 -------------- .../indexcal/GridSelfSubScoreEntity.java | 105 +++++++++++++++ .../impl/GridCorreLationServiceImpl.java | 13 +- .../FactIndexCommunitySelfSubScoreDao.xml | 2 +- .../indexcal/FactIndexGridSelfSubScoreDao.xml | 2 +- .../indexcal/GridSubScoreDao.xml | 24 ++-- 11 files changed, 227 insertions(+), 194 deletions(-) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/{FactIndexAgencySelfSubScoreEntity.java => AgencySelfSubScoreEntity.java} (83%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/{FactIndexCommunitySelfSubScoreEntity.java => CommunitySelfSubScoreEntity.java} (50%) delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 6d6632dbdf..c5bf2bab81 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -3,6 +3,7 @@ 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.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; @@ -13,6 +14,7 @@ import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.exceptions.TooManyResultsException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,19 +50,24 @@ public class AgencyServiceImpl implements AgencyService { // 验签关闭,customerId无法获取,暂时写死 - if(StringUtils.isBlank(customerId)){ + if (StringUtils.isBlank(customerId)) { customerId = "b09527201c4409e19d1dbc5e3c3429a1"; } - TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); - if (null == rootAgency){ - return new TreeResultDTO(); + TreeResultDTO rootAgency = null; + try { + rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); + if (null == rootAgency) { + return new TreeResultDTO(); + } + } catch (TooManyResultsException e) { + throw new RenException("根组织结构数据有误"); } List centerMark = this.getCenterMark(rootAgency.getCenterMarkA()); rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark); - if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){ + if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)) { List treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue()); rootAgency.setChildren(treeResultDTOS); - }else { + } else { List departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue())); rootAgency.setChildren(departmentList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java index 4be7ed8605..2c4dec2bf4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java @@ -18,7 +18,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.evaluationindex.indexcal.FactIndexCommunitySelfSubScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.CommunitySelfSubScoreEntity; import org.apache.ibatis.annotations.Mapper; /** @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexCommunitySelfSubScoreDao extends BaseDao { +public interface FactIndexCommunitySelfSubScoreDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java index af45b61b0e..d6ee6208ab 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java @@ -18,7 +18,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.evaluationindex.indexcal.FactIndexGridSelfSubScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; import org.apache.ibatis.annotations.Mapper; /** @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexGridSelfSubScoreDao extends BaseDao { +public interface FactIndexGridSelfSubScoreDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexAgencySelfSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySelfSubScoreEntity.java similarity index 83% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexAgencySelfSubScoreEntity.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySelfSubScoreEntity.java index 19c829e4e3..7a4b3d7d93 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexAgencySelfSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySelfSubScoreEntity.java @@ -28,12 +28,12 @@ import java.math.BigDecimal; * 区/街道相关 自身和下级分数表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-09-21 + * @since v1.0.0 2020-09-23 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("fact_index_agency_self_sub_score") -public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity { +public class AgencySelfSubScoreEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -73,19 +73,19 @@ public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity { private String dataType; /** - * 分数类型,self:自身得分;sub:下级得分 + * 自身指标得分 */ - private String scoreType; + private BigDecimal selfScore; /** - * 分值 + * 下级指标得分 */ - private BigDecimal score; + private BigDecimal subScore; /** - * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;街道相关:jiedaoxiangguan;全区相关:quanquxiangguan + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; */ - private String indexCode; + private String parentIndexCode; /** * 所有指标code拼接的字符串 冒号隔开 @@ -93,8 +93,13 @@ public class FactIndexAgencySelfSubScoreEntity extends BaseEpmetEntity { private String allParentIndexCode; /** - * 权重 + * 自身指标权重 */ - private BigDecimal weight; + private BigDecimal selfWeight; + + /** + * 下级指标权重 + */ + private BigDecimal subWeight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CommunitySelfSubScoreEntity.java similarity index 50% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreEntity.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CommunitySelfSubScoreEntity.java index 4bc4d33dc6..ac892b03f2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CommunitySelfSubScoreEntity.java @@ -28,68 +28,73 @@ import java.math.BigDecimal; * 社区相关 自身/下级分数表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-09-21 + * @since v1.0.0 2020-09-23 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("fact_index_community_self_sub_score") -public class FactIndexCommunitySelfSubScoreEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户Id - */ - private String customerId; - - /** - * 组织id - */ - private String agencyId; - - /** - * 社区上一级组织id - */ - private String parentAgencyId; - - /** - * 年度ID: yyyy - */ - private String yearId; - - /** - * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 - */ - private String quarterId; - - /** - * 月维度Id: yyyyMM - */ - private String monthId; - - /** - * 分数类型,self:自身得分;sub:下级得分 - */ - private String scoreType; - - /** - * 分值 - */ - private BigDecimal score; - - /** - * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;社区相关:shequxiangguan - */ - private String indexCode; - - /** - * 所有指标code拼接的字符串 冒号隔开 - */ - private String allParentIndexCode; - - /** - * 权重 - */ - private BigDecimal weight; +public class CommunitySelfSubScoreEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 社区上一级组织id + */ + private String parentAgencyId; + + /** + * 年度ID: yyyy + */ + private String yearId; + + /** + * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 + */ + private String quarterId; + + /** + * 月维度Id: yyyyMM + */ + private String monthId; + + /** + * 自身指标得分 + */ + private BigDecimal selfScore; + + /** + * 下级指标得分 + */ + private BigDecimal subScore; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; + */ + private String parentIndexCode; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + + /** + * 自身指标权重 + */ + private BigDecimal selfWeight; + + /** + * 下级指标权重 + */ + private BigDecimal subWeight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java deleted file mode 100644 index b7b73ee9ca..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexGridSelfSubScoreEntity.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity.evaluationindex.indexcal; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 网格相关自身/下级分值记录表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-09-21 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("fact_index_grid_self_sub_score") -public class FactIndexGridSelfSubScoreEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户Id - */ - private String customerId; - - /** - * 网格Id - */ - private String gridId; - - /** - * 网格所属的机关Id - */ - private String agencyId; - - /** - * 所有上级ID,用英文逗号分开 - */ - private String allParentIds; - - /** - * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 - */ - private String quarterId; - - /** - * 年度ID: yyyy - */ - private String yearId; - - /** - * 月维度Id: yyyyMM - */ - private String monthId; - - /** - * 分数类型,self:自身得分;sub:下级得分 - */ - private String scoreType; - - /** - * 分值 - */ - private BigDecimal score; - - /** - * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;网格相关:wanggexiangguan - */ - private String indexCode; - - /** - * 所有指标code拼接的字符串 冒号隔开 - */ - private String allParentIndexCode; - - /** - * 权重 - */ - private BigDecimal weight; - -} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java new file mode 100644 index 0000000000..472d12074e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSelfSubScoreEntity.java @@ -0,0 +1,105 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.indexcal; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 网格相关自身/下级分值记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("fact_index_grid_self_sub_score") +public class GridSelfSubScoreEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id + */ + private String gridId; + + /** + * 网格所属的机关Id + */ + private String agencyId; + + /** + * 所有上级ID,用英文逗号分开 + */ + private String allParentIds; + + /** + * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 + */ + private String quarterId; + + /** + * 年度ID: yyyy + */ + private String yearId; + + /** + * 月维度Id: yyyyMM + */ + private String monthId; + + /** + * 自身指标得分 + */ + private BigDecimal selfScore; + + /** + * 下级指标得分 + */ + private BigDecimal subScore; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; + */ + private String parentIndexCode; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + + /** + * 自身指标权重 + */ + private BigDecimal selfWeight; + + /** + * 下级指标权重 + */ + private BigDecimal subWeight; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index bf04a2b990..d4fc251cdb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -110,13 +110,20 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { indexList.forEach(index -> { String levelIndexPath = index.getAllParentIndexCode().concat(StrConstant.COLON).concat(index.getIndexCode()); //获取出指标之间的关系 - List slefsubIndexList = indexGroupDetailDao.selectSelfSubIndex(formDTO.getCustomerId(), levelIndexPath); - if (CollectionUtils.isEmpty(slefsubIndexList)) { - log.error("calculateSelfSubScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); + List selfSubIndexList = indexGroupDetailDao.selectSelfSubIndex(formDTO.getCustomerId(), levelIndexPath); + if (CollectionUtils.isEmpty(selfSubIndexList)) { + log.error("calculateSelfSubScore indexGroupDetailDao.selectSelfSubIndex return empty,customerId:{}", formDTO.getCustomerId()); return; } //获取该能力下的分数 List subScore = gridSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath); + if (CollectionUtils.isEmpty(subScore)) { + log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + return; + } + selfSubIndexList.forEach(score -> { + + }); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml index 6987c01df5..f97b98ce61 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml @@ -3,7 +3,7 @@ - + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml index 0585208907..ea015c53c0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml @@ -3,7 +3,7 @@ - + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml index 563457b520..d04a0356d5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml @@ -68,20 +68,24 @@ \ No newline at end of file From 3426d3bf6d4f92c81c7694a85a10ac960ecf30d2 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Sep 2020 11:05:08 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=85=9A=E5=91=98=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 3 + .../com/epmet/constant/ScreenConstant.java | 12 + .../extract/form/PartyBaseInfoFormDTO.java | 132 +++++++++++ .../result/CustomerAgencyInfoResultDTO.java | 35 +++ .../result/PartyMemberInfoResultDTO.java | 51 +++++ .../extract/result/UserCountResultDTO.java | 35 +++ .../screen/ScreenCpcBaseDataDao.java | 19 ++ .../screen/ScreenCustomerAgencyDao.java | 9 + .../dao/stats/DimCustomerPartymemberDao.java | 10 + .../FactParticipationUserAgencyDailyDao.java | 10 + .../FactParticipationUserGridDailyDao.java | 10 + .../impl/PartyBaseInfoServiceImpl.java | 211 +++++++++++++++++- .../screen/ScreenCpcBaseDataService.java | 21 ++ .../screen/ScreenCustomerAgencyService.java | 11 + .../impl/ScreenCpcBaseDataServiceImpl.java | 20 ++ .../impl/ScreenCustomerAgencyServiceImpl.java | 18 +- .../stats/DimCustomerPartymemberService.java | 10 + .../DimCustomerPartymemberServiceImpl.java | 13 ++ ...ctParticipationUserAgencyDailyService.java | 10 + ...FactParticipationUserGridDailyService.java | 10 + ...rticipationUserAgencyDailyServiceImpl.java | 13 ++ ...ParticipationUserGridDailyServiceImpl.java | 13 ++ .../screen/ScreenCpcBaseDataDao.xml | 68 ++++++ .../screen/ScreenCustomerAgencyDao.xml | 15 ++ .../stats/DimCustomerPartymemberDao.xml | 25 +++ .../FactParticipationUserAgencyDailyDao.xml | 14 ++ .../FactParticipationUserGridDailyDao.xml | 14 ++ 27 files changed, 805 insertions(+), 7 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java 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 1d727fb297..bcef31dc14 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 @@ -31,8 +31,11 @@ public interface NumConstant { int FOURTEEN=14; int TWENTY = 20; int THIRTY = 30; + int THIRTY_ONE = 31; int FORTY = 40; + int FORTY_ONE = 41; int FIFTY = 50; + int FIFTY_ONE = 51; int SIXTY = 60; int ONE_HUNDRED = 100; int ONE_THOUSAND = 1000; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java index e7bb0e3dc3..43c9e08e40 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java @@ -8,10 +8,22 @@ public interface ScreenConstant { String COMMUNITY = "community"; + String STREET = "street"; + + String DISTRICT = "district"; + + String CITY = "city"; + + String PROVINCE = "province"; + String LEVEL = "level"; String STR_NULL = ""; String ENGLISH_COMMA = ","; + String GRID = "grid"; + + String AGENCY = "agency"; + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java new file mode 100644 index 0000000000..436208c1e7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/PartyBaseInfoFormDTO.java @@ -0,0 +1,132 @@ +package com.epmet.dto.extract.form; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/22 3:19 下午 + */ +@Data +public class PartyBaseInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 1685776533893300943L; + + /** + * ID 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 组织类别 agency:组织;部门:department;网格:grid + */ + private String orgType; + + /** + * 组织Id 可以为网格,机关id + */ + private String orgId; + + /** + * 上级组织Id + */ + private String parentId; + + /** + * 组织名称 + */ + private String orgName; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + + /** + * 注册用户数 + */ + private Integer registerUserCount; + + /** + * 群众用户数 + */ + private Integer resiTotal; + + /** + * 注册党员数 + */ + private Integer partyMemberCount; + + /** + * 小于20岁的党员总人数 + */ + private Integer ageLevel1; + + /** + * 20-30岁的党员总人数 + */ + private Integer ageLevel2; + + /** + * 31-40岁的党员总人数 + */ + private Integer ageLevel3; + + /** + * 41-50岁的党员总人数 + */ + private Integer ageLevel4; + + /** + * 51-60岁的党员总人数 + */ + private Integer ageLevel5; + + /** + * 60+岁的党员总人数 + */ + private Integer ageLevel6; + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 更新人 + */ + private String updatedBy; + + public PartyBaseInfoFormDTO() { + this.registerUserCount = NumConstant.ZERO; + this.resiTotal = NumConstant.ZERO; + this.partyMemberCount = NumConstant.ZERO; + this.ageLevel1 = NumConstant.ZERO; + this.ageLevel2 = NumConstant.ZERO; + this.ageLevel3 = NumConstant.ZERO; + this.ageLevel4 = NumConstant.ZERO; + this.ageLevel5 = NumConstant.ZERO; + this.ageLevel6 = NumConstant.ZERO; + this.delFlag = NumConstant.ZERO_STR; + this.revision = NumConstant.ZERO; + this.createdBy = "APP_USER"; + this.updatedBy = "APP_USER"; + } +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java new file mode 100644 index 0000000000..5828ead388 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/CustomerAgencyInfoResultDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/22 4:21 下午 + */ +@Data +public class CustomerAgencyInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -584952326059903779L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 机关名称 + */ + private String agencyName; + + /** + * 机关父级ID + */ + private String pid; + + /** + * 机关级别 + */ + private String level; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java new file mode 100644 index 0000000000..24e5ec021a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2020/9/22 5:23 下午 + */ +@Data +public class PartyMemberInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 6591845785373556485L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 父级ID + */ + private String parentId; + + /** + * 生日 + */ + private Date birthday; + + /** + * 年龄 + */ + private Integer age; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 机关名称 + */ + private String agencyName; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java new file mode 100644 index 0000000000..0d5e34a62d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/UserCountResultDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/23 9:54 上午 + */ +@Data +public class UserCountResultDTO implements Serializable { + + private static final long serialVersionUID = -6349371693110337172L; + + /** + * 群众用户数 + */ + private Integer resiTotal; + + /** + * 注册用户数 + */ + private Integer registerUserCount; + + /** + * 注册党员数 + */ + private Integer partyMemberCount; + + /** + * 网格ID / 机关ID + */ + private String orgId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java index 748d31d161..5f7b459cd3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.screencoll.form.CpcBaseDataFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -55,4 +56,22 @@ public interface ScreenCpcBaseDataDao extends BaseDao { * @Date 10:52 2020-08-18 **/ void batchInsertCpcBaseData(@Param("list") List list, @Param("customerId")String customerId); + + /** + * @Description 插入党员基本信息 + * @param baseInfos + * @author zxc + * @date 2020/9/22 3:28 下午 + */ + void insertPartyBaseInfo(@Param("baseInfos") List baseInfos); + + /** + * @Description 删除旧的党员基本信息 + * @param customerId + * @param dateId + * @param orgIds + * @author zxc + * @date 2020/9/22 3:28 下午 + */ + Integer deleteOldPartyBaseInfo(@Param("customerId") String customerId,@Param("dateId") String dateId,@Param("orgIds")List orgIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 7d9362a1aa..30b8141033 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.result.TreeResultDTO; import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; @@ -120,6 +121,14 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectSubAgencyList(@Param("pids") String pids); + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/22 4:06 下午 + */ + List selectAllAgencyId(@Param("customerId") String customerId); + ScreenCustomerAgencyEntity getLastAddedAgency(); ScreenCustomerAgencyEntity getLastUpdatedAgency(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java index eee170f6f7..6c7ab9f1a5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.PartyMemberInfoResultDTO; import com.epmet.dto.stats.form.DimCustomerPartyMemberFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.entity.stats.DimCustomerPartymemberEntity; @@ -60,4 +61,13 @@ public interface DimCustomerPartymemberDao extends BaseDao selectPartyMemberList(String customerId); + + /** + * @Description 查询党员信息 + * @param customerId + * @param gridIds + * @author zxc + * @date 2020/9/22 5:26 下午 + */ + List selectPartyMemberInfo(@Param("customerId")String customerId,@Param("gridIds") List gridIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java index 4a5b254b8f..f74e27ede1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserAgencyDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserAgencyDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,4 +39,13 @@ public interface FactParticipationUserAgencyDailyDao extends BaseDao selectUserCount(String customerId, String dateId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java index d39a6088e1..248efe22a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserGridDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserGridDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,4 +39,13 @@ public interface FactParticipationUserGridDailyDao extends BaseDao selectUserCount(String customerId, String dateId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java index 39a7724f3a..73bc4f2135 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java @@ -1,12 +1,29 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; +import com.epmet.dto.extract.result.PartyMemberInfoResultDTO; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; +import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService; import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.stats.DimCustomerPartymemberService; +import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService; +import com.epmet.service.stats.user.FactParticipationUserGridDailyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import com.epmet.constant.ScreenConstant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Desciption 党员基本情况 @@ -19,6 +36,14 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { @Autowired private ScreenCustomerAgencyService agencyService; + @Autowired + private DimCustomerPartymemberService partyMemberService; + @Autowired + private FactParticipationUserGridDailyService userGridDailyService; + @Autowired + private FactParticipationUserAgencyDailyService userAgencyDailyService; + @Autowired + private ScreenCpcBaseDataService cpcBaseDataService; /** * @Description 统计基层党建-党员基本情况 @@ -29,9 +54,187 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { */ @Override public Boolean statsPartyMemberBaseInfoToScreen(String customerId, String dateId) { - String agencyId = "cyagstrbee8711eaa1fac03fd56f7847"; - Map stringObjectMap = agencyService.selectAllSubAgencyId(agencyId, customerId); - System.out.println(stringObjectMap); - return null; + List agencyIdList = agencyService.selectAllAgencyId(customerId); + if (!CollectionUtils.isEmpty(agencyIdList)){ + Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); + if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ + List customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY); + disPose(customerGridInfoList,true,customerId,dateId); + }else if (groupByLevel.containsKey(ScreenConstant.STREET)){ + List customerGridInfoList = groupByLevel.get(ScreenConstant.STREET); + disPose(customerGridInfoList,false,customerId,dateId); + }else if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + List customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT); + disPose(customerGridInfoList,false,customerId,dateId); + }else if (groupByLevel.containsKey(ScreenConstant.CITY)){ + List customerGridInfoList = groupByLevel.get(ScreenConstant.CITY); + disPose(customerGridInfoList,false,customerId,dateId); + }else if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + List customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE); + disPose(customerGridInfoList,false,customerId,dateId); + }else { + // TODO 干啥 + } + } + return true; + } + + /** + * @Description + * @param isGrid true:level = community + * @author zxc + * @date 2020/9/22 4:48 下午 + */ + public void disPose(List agencyIdList, Boolean isGrid, String customerId, String dateId){ + if (!CollectionUtils.isEmpty(agencyIdList)){ + List result = new ArrayList<>(); + if (isGrid == true){ + List userCountList = userGridDailyService.selectUserCount(customerId, dateId); + agencyIdList.forEach(agency -> { + // 1. 处理社区下的所有网格中的党员信息 + String agencyId = agency.getAgencyId(); + Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); + List gridIds = (List) agencyMap.get(agencyId); + List partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); + if (!CollectionUtils.isEmpty(partyMemberInfoList)){ + partyMemberInfoList.forEach(party -> { + party.setAge(getAge(party.getBirthday())); + }); + Map> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId)); + groupByGridId.forEach((gridId,partyInfos) -> { + PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); + form.setOrgType(ScreenConstant.GRID); + form.setOrgId(gridId); + form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName()); + form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false)); + form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY)); + form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); + form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); + form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); + form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); + form.setCustomerId(customerId); + form.setDataEndTime(dateId); + form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); + if (!CollectionUtils.isEmpty(userCountList)){ + userCountList.forEach(user -> { + if (gridId.equals(user.getOrgId())){ + form.setResiTotal(user.getResiTotal()); + form.setRegisterUserCount(user.getRegisterUserCount()); + form.setPartyMemberCount(user.getPartyMemberCount()); + } + }); + } + result.add(form); + }); + } + }); + // 2. 处理社区级别的党员信息 + Map> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId)); + groupByAgency.forEach((commAgencyId,party) -> { + PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); + form.setOrgName(party.get(NumConstant.ZERO).getOrgName()); + form.setOrgId(commAgencyId); + form.setOrgType(ScreenConstant.AGENCY); + form.setParentId(party.get(NumConstant.ZERO).getParentId()); + form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1))); + form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2))); + form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3))); + form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4))); + form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5))); + form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6))); + form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount))); + form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal))); + form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); + result.add(form); + }); + delAndInsert(result,customerId,dateId); + }else { + List userCountRList = userAgencyDailyService.selectUserCount(customerId, dateId); + agencyIdList.forEach(agency -> { + String agencyId = agency.getAgencyId(); + Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); + List agencyIds = (List) agencyMap.get(agencyId); + // todo + }); + } + } + } + + /** + * @Description 根据生日计算年龄 + * @param birthday + * @author zxc + * @date 2020/9/22 5:34 下午 + */ + public Integer getAge(Date birthday){ + LocalDate now = LocalDate.now(); + int nowYear = now.getYear(); + int nowMonth = now.getMonthValue(); + int nowDayOfMonth = now.getDayOfMonth(); + LocalDate birth = birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + int birthDayYear = birth.getYear(); + int birthDayMonth = birth.getMonthValue(); + int birthDayOfMonth = birth.getDayOfMonth(); + int age = nowYear - birthDayYear; + if (nowMonth < birthDayMonth || (nowMonth == birthDayMonth && nowDayOfMonth < birthDayOfMonth)) { + age--; + } + return age; + } + + /** + * @Description 处理年龄段之间的人数 + * @param partyMemberInfoList + * @param startAge + * @param endAge + * @author zxc + * @date 2020/9/22 5:45 下午 + */ + public Integer disposeAgeArea(List partyMemberInfoList, Integer startAge,Integer endAge ){ + if (!CollectionUtils.isEmpty(partyMemberInfoList)){ + List collect = partyMemberInfoList.stream().filter(p -> p.getAge() >= startAge).filter(p -> p.getAge() <= endAge).collect(Collectors.toList()); + return collect.size(); + } + return NumConstant.ZERO; + } + + /** + * @Description 计算 大于/小于 年龄的人数 + * @param partyMemberInfoList + * @param age + * @param isGreater 是否是 大于 + * @author zxc + * @date 2020/9/22 5:49 下午 + */ + public Integer disposeAge(List partyMemberInfoList, Integer age , Boolean isGreater){ + if (!CollectionUtils.isEmpty(partyMemberInfoList)){ + List collect = new ArrayList<>(); + if (isGreater == true){ + collect = partyMemberInfoList.stream().filter(p -> p.getAge() > age).collect(Collectors.toList()); + }else { + collect = partyMemberInfoList.stream().filter(p -> p.getAge() < age).collect(Collectors.toList()); + } + return collect.size(); + } + return NumConstant.ZERO; + } + + /** + * @Description + * @param result + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/23 10:13 上午 + */ + public void delAndInsert(List result, String customerId, String dateId){ + if (!CollectionUtils.isEmpty(result)){ + List orgIds = result.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); + Integer delNum; + do { + delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds); + }while (delNum > NumConstant.ZERO); + cpcBaseDataService.insertPartyBaseInfo(result); + } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java index 55d6e9bcd2..59e1c481f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java @@ -18,8 +18,11 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity; +import java.util.List; + /** * 基层党建-党员基本情况 * @@ -28,4 +31,22 @@ import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity; */ public interface ScreenCpcBaseDataService extends BaseService { + /** + * @Description 插入党员基本信息 + * @param baseInfoFormDTOS + * @author zxc + * @date 2020/9/22 3:28 下午 + */ + void insertPartyBaseInfo(List baseInfoFormDTOS); + + /** + * @Description 删除旧的党员基本信息 + * @param customerId + * @param dateId + * @param orgIds + * @author zxc + * @date 2020/9/22 3:28 下午 + */ + Integer deleteOldPartyBaseInfo(String customerId, String dateId, List orgIds); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 4928669aaa..fcff5aca3f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -17,6 +17,9 @@ package com.epmet.service.evaluationindex.screen; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; + +import java.util.List; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.org.CustomerAgencyEntity; @@ -42,6 +45,14 @@ public interface ScreenCustomerAgencyService{ */ Map selectAllSubAgencyId(String agencyId, String customerId); + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/22 4:06 下午 + */ + List selectAllAgencyId(String customerId); + ScreenCustomerAgencyEntity getLastAddedAgency(); ScreenCustomerAgencyEntity getLastUpdatedAgency(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java index 51e81f0f23..ee76c86d32 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java @@ -19,10 +19,13 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.evaluationindex.screen.ScreenCpcBaseDataDao; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity; import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService; import org.springframework.stereotype.Service; +import java.util.List; + /** * 基层党建-党员基本情况 @@ -34,4 +37,21 @@ import org.springframework.stereotype.Service; public class ScreenCpcBaseDataServiceImpl extends BaseServiceImpl implements ScreenCpcBaseDataService { + @Override + public void insertPartyBaseInfo(List baseInfoFormDTOS) { + baseDao.insertPartyBaseInfo(baseInfoFormDTOS); + } + + /** + * @Description 删除旧的党员基本信息 + * @param customerId + * @param dateId + * @param orgIds + * @author zxc + * @date 2020/9/22 3:28 下午 + */ + @Override + public Integer deleteOldPartyBaseInfo(String customerId, String dateId, List orgIds) { + return baseDao.deleteOldPartyBaseInfo(customerId, dateId,orgIds); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index cdb9d68da4..bb4e95e6ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.result.TreeResultDTO; import com.epmet.constant.ScreenConstant; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; @@ -77,18 +78,18 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ resultMap.put(agencyId,gridIdList); }else { resultMap.put(ScreenConstant.LEVEL,rootAgency.getLevel()); - resultMap.put(agencyId,getDepartmentList((ScreenConstant.STR_NULL.equals(rootAgency.getPids())||rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getAgencyId() : rootAgency.getPids().concat(ScreenConstant.ENGLISH_COMMA).concat(rootAgency.getAgencyId()))); + resultMap.put(agencyId,getSubList((ScreenConstant.STR_NULL.equals(rootAgency.getPids())||rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getAgencyId() : rootAgency.getPids().concat(ScreenConstant.ENGLISH_COMMA).concat(rootAgency.getAgencyId()))); } return resultMap; } - private List getDepartmentList(String subAgencyPids) { + private List getSubList(String subAgencyPids) { List result = new ArrayList<>(); List subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids); if (!CollectionUtils.isEmpty(subAgencyList)) { result.addAll(subAgencyList.stream().map(sub -> sub.getAgencyId()).collect(Collectors.toList())); subAgencyList.forEach(sub -> { - List subAgency = getDepartmentList(sub.getPids() + "," + sub.getAgencyId()); + List subAgency = getSubList(sub.getPids() + "," + sub.getAgencyId()); result.addAll(subAgency); }); } @@ -157,4 +158,15 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ cae.setSourceType(OrgSourceTypeConstant.INTERNAL); screenCustomerAgencyDao.insert(cae); } + + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/22 4:06 下午 + */ + @Override + public List selectAllAgencyId(String customerId) { + return screenCustomerAgencyDao.selectAllAgencyId(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java index 137aebedbe..d19dbc8aa5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java @@ -19,6 +19,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.extract.result.PartyMemberInfoResultDTO; import com.epmet.dto.stats.DimCustomerPartymemberDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; @@ -111,4 +112,13 @@ public interface DimCustomerPartymemberService extends BaseService selectPartyMemberList(String customerId); + + /** + * @Description 查询党员信息 + * @param customerId + * @param gridIds + * @author zxc + * @date 2020/9/22 5:26 下午 + */ + List selectPartyMemberInfo(String customerId,List gridIds); } \ No newline at end of file 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 689592e636..86fd72a3ca 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 @@ -30,6 +30,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.StatsConstant; import com.epmet.dao.stats.DimCustomerPartymemberDao; +import com.epmet.dto.extract.result.PartyMemberInfoResultDTO; import com.epmet.dto.stats.DimCustomerPartymemberDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.dto.stats.form.DimCustomerPartyMemberFormDTO; @@ -174,6 +175,18 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl selectPartyMemberInfo(String customerId, List gridIds) { + return baseDao.selectPartyMemberInfo(customerId, gridIds); + } + /** * @Description 删除旧纪录,插入新纪录 * @param partyMemberList diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserAgencyDailyService.java index f489c17788..22923f3b3a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserAgencyDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserAgencyDailyService.java @@ -19,6 +19,7 @@ package com.epmet.service.stats.user; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserAgencyDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserAgencyDailyEntity; @@ -93,4 +94,13 @@ public interface FactParticipationUserAgencyDailyService extends BaseService selectUserCount(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserGridDailyService.java index 5b4ef692c7..6dba137e58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserGridDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/FactParticipationUserGridDailyService.java @@ -19,6 +19,7 @@ package com.epmet.service.stats.user; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserGridDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserGridDailyEntity; @@ -93,4 +94,13 @@ public interface FactParticipationUserGridDailyService extends BaseService selectUserCount(String customerId,String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserAgencyDailyServiceImpl.java index f606044f1f..6ad42a15fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserAgencyDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserAgencyDailyServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.user.FactParticipationUserAgencyDailyDao; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserAgencyDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserAgencyDailyEntity; import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService; @@ -98,4 +99,16 @@ public class FactParticipationUserAgencyDailyServiceImpl extends BaseServiceImpl baseDao.deleteBatchIds(Arrays.asList(ids)); } + /** + * @Description 查询机关下用户信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/23 9:57 上午 + */ + @Override + public List selectUserCount(String customerId, String dateId) { + return baseDao.selectUserCount(customerId, dateId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserGridDailyServiceImpl.java index 8d6915f6fa..1b4e69ecc9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/FactParticipationUserGridDailyServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.user.FactParticipationUserGridDailyDao; +import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.dto.stats.user.FactParticipationUserGridDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserGridDailyEntity; import com.epmet.service.stats.user.FactParticipationUserGridDailyService; @@ -99,4 +100,16 @@ public class FactParticipationUserGridDailyServiceImpl extends BaseServiceImpl selectUserCount(String customerId, String dateId) { + return baseDao.selectUserCount(customerId, dateId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml index 03270712ee..ee15c1d90b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml @@ -64,5 +64,73 @@ + + + insert into screen_cpc_base_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + REGISTER_USER_COUNT, + RESI_TOTAL, + PARTY_MEMBER_COUNT, + AGE_LEVEL_1, + AGE_LEVEL_2, + AGE_LEVEL_3, + AGE_LEVEL_4, + AGE_LEVEL_5, + AGE_LEVEL_6, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + REPLACE(UUID(), '-', ''), + #{customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.registerUserCount}, + #{item.resiTotal}, + #{item.partyMemberCount}, + #{item.ageLevel1}, + #{item.ageLevel2}, + #{item.ageLevel3}, + #{item.ageLevel4}, + #{item.ageLevel5}, + #{item.ageLevel6}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + now(), + #{item.updatedBy}, + now() + ) + + + + + + + delete from screen_cpc_base_data + where CUSTOMER_ID = #{customerId} + and DATA_END_TIME = #{dateId} + and + ( + + org_id = #{orgId} + + ) + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 7067515e0a..dccf276fac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -243,4 +243,19 @@ from screen_customer_agency sca where sca.AGENCY_ID = #{agencyId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml index 3075cedca7..c886a90095 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml @@ -87,4 +87,29 @@ dcp.DEL_FLAG = '0' AND dcp.CUSTOMER_ID =#{customerId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml index b41b6f89dd..f23abdcbf1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml @@ -102,5 +102,19 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml index 575cea1844..96e16db5be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml @@ -107,5 +107,19 @@ + + + \ No newline at end of file From 24536ebcf87ade6eee044a0bf93d3f6f3b75708c Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 23 Sep 2020 13:30:57 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcal/FactIndexAgencySelfSubScoreDao.java | 4 ++-- .../indexcal/impl/GridCorreLationServiceImpl.java | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java index af290b9ca6..be0033d735 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java @@ -18,7 +18,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.evaluationindex.indexcal.FactIndexAgencySelfSubScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import org.apache.ibatis.annotations.Mapper; /** @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexAgencySelfSubScoreDao extends BaseDao { +public interface FactIndexAgencySelfSubScoreDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index d4fc251cdb..2037c86fb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -19,6 +19,7 @@ import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.*; +import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; @@ -121,8 +122,18 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } - selfSubIndexList.forEach(score -> { - + Map selfSubParentMap = new HashMap<>(); + selfSubIndexList.forEach(o -> { + //找出自身 和下级的指标 + if (o.getAllParentIndexCode().contains("xiaji")) { + selfSubParentMap.put(o.getAllParentIndexCode(), "xiaji"); + } else { + selfSubParentMap.put(o.getAllParentIndexCode(), "zishen"); + } + }); + Map insertList = new HashMap<>(); + subScore.forEach(score -> { + insertList.get(score.getAllParentIndexCode()); }); }); } From 676c76c9ff4398966661f6718b179a908bdba9f0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Sep 2020 13:45:22 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E5=85=9A=E5=91=98=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/form/IssueLogDailyFormDTO.java | 2 ++ .../extract/form/IssueMainDailyFormDTO.java | 2 ++ .../extract/result/AgencyInfoResultDTO.java | 2 ++ .../screen/ScreenCustomerAgencyDao.java | 9 ++++++++ .../todata/impl/IssueExtractServiceImpl.java | 2 ++ .../impl/PartyBaseInfoServiceImpl.java | 7 ++++-- .../screen/ScreenCustomerAgencyService.java | 10 +++++++- .../impl/ScreenCustomerAgencyServiceImpl.java | 12 ++++++++++ .../extract/FactOriginIssueLogDailyDao.xml | 2 ++ .../extract/FactOriginIssueMainDailyDao.xml | 2 ++ .../FactIndexAgencySelfSubScoreDao.xml | 23 ------------------- .../screen/ScreenCustomerAgencyDao.xml | 12 ++++++++++ .../resources/mapper/stats/DimAgencyDao.xml | 3 ++- 13 files changed, 61 insertions(+), 27 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java index 4e0e26026c..fa2228bbbb 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueLogDailyFormDTO.java @@ -33,6 +33,8 @@ public class IssueLogDailyFormDTO implements Serializable { */ private String pid; + private String pids; + /** * 机关ID */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java index bb7a5b5ea7..0f4fccc58f 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IssueMainDailyFormDTO.java @@ -79,6 +79,8 @@ public class IssueMainDailyFormDTO implements Serializable { */ private String pid; + private String pids; + /** * 议题组织ID(网格所属组织ID) */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java index 6434fd6836..2bc3b897e7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyInfoResultDTO.java @@ -22,4 +22,6 @@ public class AgencyInfoResultDTO implements Serializable { * 机关的父ID */ private String pid; + + private String pids; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 30b8141033..9eb43a08a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -134,4 +134,13 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectSubAgencyId(@Param("agencyId") String agencyId,@Param("customerId") String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index 58ff657485..8d090d614b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -126,6 +126,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(pid -> { if (r.getAgencyId().equals(pid.getAgencyId())){ r.setPid(pid.getPid()); + r.setPids(pid.getPids()); } }); }); @@ -219,6 +220,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(agency -> { if (r.getAgencyId().equals(agency.getAgencyId())){ r.setPid(agency.getPid()); + r.setPids(agency.getPids()); } }); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java index 73bc4f2135..eedcc6f1c0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java @@ -14,6 +14,7 @@ import com.epmet.service.stats.user.FactParticipationUserGridDailyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import com.epmet.constant.ScreenConstant; @@ -97,6 +98,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { List gridIds = (List) agencyMap.get(agencyId); List partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); if (!CollectionUtils.isEmpty(partyMemberInfoList)){ + // 为每个人赋值年龄 partyMemberInfoList.forEach(party -> { party.setAge(getAge(party.getBirthday())); }); @@ -152,8 +154,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { List userCountRList = userAgencyDailyService.selectUserCount(customerId, dateId); agencyIdList.forEach(agency -> { String agencyId = agency.getAgencyId(); - Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); - List agencyIds = (List) agencyMap.get(agencyId); + // 下级机关agencyId + List agencyIds = agencyService.selectSubAgencyId(agencyId, customerId); // todo }); } @@ -227,6 +229,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { * @author zxc * @date 2020/9/23 10:13 上午 */ + @Transactional(rollbackFor = Exception.class) public void delAndInsert(List result, String customerId, String dateId){ if (!CollectionUtils.isEmpty(result)){ List orgIds = result.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index fcff5aca3f..43af0f75f3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -23,7 +23,6 @@ import java.util.List; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.org.CustomerAgencyEntity; -import java.util.List; import java.util.Map; /** @@ -58,4 +57,13 @@ public interface ScreenCustomerAgencyService{ ScreenCustomerAgencyEntity getLastUpdatedAgency(); void initAgencies(List agencies2Add, List agencies2Update); + + /** + * @Description 查询下一级机关的ID【即以agencyId为pid的agency】 + * @param agencyId + * @param customerId + * @author zxc + * @date 2020/9/23 11:11 上午 + */ + List selectSubAgencyId(String agencyId, String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index bb4e95e6ad..398c416acb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -135,6 +135,18 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ } } + /** + * @Description 查询下一级机关的ID【即以agencyId为pid的agency】 + * @param agencyId + * @param customerId + * @author zxc + * @date 2020/9/23 11:11 上午 + */ + @Override + public List selectSubAgencyId(String agencyId, String customerId) { + return screenCustomerAgencyDao.selectSubAgencyId(agencyId, customerId); + } + private void updateAgency(ScreenCustomerAgencyEntity exists) { screenCustomerAgencyDao.updateById(exists); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 1f62f10256..23659b879a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -10,6 +10,7 @@ CUSTOMER_ID, GRID_ID, PID, + PIDS, AGENCY_ID, DATE_ID, WEEK_ID, @@ -33,6 +34,7 @@ #{item.customerId}, #{item.gridId}, #{item.pid}, + #{item.pids}, #{item.agencyId}, #{item.dateId}, #{item.weekId}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index a15bd53984..e65c1ff8b8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -19,6 +19,7 @@ TOPIC_ID, GRID_ID, PID, + PIDS, AGENCY_ID, ISSUE_STATUS, TOPIC_USER_IS_PARTY, @@ -44,6 +45,7 @@ #{item.topicId}, #{item.gridId}, #{item.pid}, + #{item.pids}, #{item.agencyId}, #{item.issueStatus}, #{item.topicUserIsParty}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml index fa016f4fbc..0fd2472f7e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.xml @@ -3,27 +3,4 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index dccf276fac..1da83a86be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -258,4 +258,16 @@ AND CUSTOMER_ID = #{customerId} ORDER BY created_time DESC + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index 58dbc205d9..f0df043bf5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -303,7 +303,8 @@ + SELECT + scbd.CUSTOMER_ID, + scbd.ORG_TYPE, + scbd.PARENT_ID AS orgId, + scbd.REGISTER_USER_COUNT, + scbd.RESI_TOTAL, + scbd.PARTY_MEMBER_COUNT, + scbd.AGE_LEVEL_1, + scbd.AGE_LEVEL_2, + scbd.AGE_LEVEL_3, + scbd.AGE_LEVEL_4, + scbd.AGE_LEVEL_5, + scbd.AGE_LEVEL_6, + sca.PID AS parentId, + sca.AGENCY_NAME AS orgName + FROM + screen_cpc_base_data scbd + LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = scbd.PARENT_ID + WHERE + scbd.del_flag = '0' + AND sca.DEL_FLAG = 0 + AND scbd.ORG_TYPE = 'agency' + AND scbd.DATA_END_TIME = #{dateId} + AND scbd.CUSTOMER_ID = #{customerId} + AND PARENT_ID = #{agencyId} + + insert into screen_cpc_base_data ( From 2e6b6b0ee16290c649c5e8040a4cafc8117db671 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Sep 2020 14:24:12 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E5=85=9A=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96=E6=B7=BB=E5=8A=A0pids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java | 2 ++ .../com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java | 2 ++ .../service/stats/impl/DimCustomerPartymemberServiceImpl.java | 1 + .../main/resources/mapper/stats/DimCustomerPartymemberDao.xml | 2 ++ .../src/main/resources/mapper/stats/DimGridDao.xml | 3 ++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java index 9a57ade5e6..8ff5479b0f 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/DimCustomerPartyMemberFormDTO.java @@ -35,6 +35,8 @@ public class DimCustomerPartyMemberFormDTO implements Serializable { */ private String parentId; + private String pids; + /** * 党员认证成功的日期yyyyMMdd */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java index a04c5fe2b4..16f870e85e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridBelongAgencyResultDTO.java @@ -27,4 +27,6 @@ public class GridBelongAgencyResultDTO implements Serializable { * 机关的上级ID */ private String parentId; + + private String pids; } 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 86fd72a3ca..62cefb9ffa 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 @@ -154,6 +154,7 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl Date: Wed, 23 Sep 2020 14:33:49 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=85=E9=83=A8?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E8=AE=A4=E8=AF=81=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-commons-extapp-auth/pom.xml | 6 + .../annotation/InternalAppRequestAuth.java | 32 +++++ .../aspect/ExternalAppRequestAuthAspect.java | 117 +++++++++++++++- .../extappauth/jwt/JwtTokenProperties.java | 41 ++++++ .../commons/extappauth/jwt/JwtTokenUtils.java | 130 ++++++++++++++++++ .../tools/exception/EpmetErrorCode.java | 2 +- .../epmet/controller/test/TestController.java | 19 --- 7 files changed, 325 insertions(+), 22 deletions(-) create mode 100644 epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java create mode 100644 epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java create mode 100644 epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java delete mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml index de7060d57f..b563afcb7d 100644 --- a/epmet-commons/epmet-commons-extapp-auth/pom.xml +++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml @@ -27,6 +27,12 @@ + + io.jsonwebtoken + jjwt + 0.7.0 + + org.springframework.boot spring-boot-starter-web diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java new file mode 100644 index 0000000000..921860627c --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/InternalAppRequestAuth.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 http://www.renren.io + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.epmet.commons.extappauth.annotation; + +import java.lang.annotation.*; + +/** + * 需要认证的内部请求 + * @Author wxz + * @Description + * @Date 2020/4/23 16:17 + **/ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface InternalAppRequestAuth { + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java index ec98b35d7b..c9b252c0ca 100644 --- a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java @@ -1,13 +1,23 @@ package com.epmet.commons.extappauth.aspect; +import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.extappauth.jwt.JwtTokenUtils; import com.epmet.commons.tools.exception.EpmetErrorCode; 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.security.dto.BaseTokenDto; +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import io.jsonwebtoken.Claims; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -24,6 +34,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Parameter; +import java.util.Map; /** * 外部应用请求认证切面 @@ -35,6 +46,7 @@ public class ExternalAppRequestAuthAspect { private static Logger logger = LoggerFactory.getLogger(ExternalAppRequestAuthAspect.class); + public static final String AUTHORIZATION_TOKEN_HEADER_KEY = "Authorization"; public static final String ACCESS_TOKEN_HEADER_KEY = "AccessToken"; public static final String APP_ID_HEADER_KEY = "appId"; public static final String APP_ID_TIMESTAMP_KEY = "ts"; @@ -44,15 +56,117 @@ public class ExternalAppRequestAuthAspect { @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private JwtTokenUtils jwtTokenUtils; + + @Autowired + private RedisUtils redisUtils; + /** * 拦截加了ExternalRequestAuth注解的方法 * * @param point * @throws Throwable */ - @Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth)") + @Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth) " + + "|| @annotation(com.epmet.commons.extappauth.annotation.InternalAppRequestAuth)") public void auth(JoinPoint point) throws Throwable { + MethodSignature signature = (MethodSignature) point.getSignature(); HttpServletRequest request = getRequest(); + + if (signature.getMethod().getAnnotation(ExternalAppRequestAuth.class) != null + && StringUtils.isNotBlank(request.getHeader(ACCESS_TOKEN_HEADER_KEY))) { + // 走外部应用认证 + extAppAuth(signature, point, request); + } else if (signature.getMethod().getAnnotation(InternalAppRequestAuth.class) != null + && StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY))) { + // 走内部应用认证 + String customerId = null; + internalAppAuth(signature, point, request); + } else { + throw new RenException(EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getCode(), EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getMsg()); + } + } + + /** + * 内部应用认证 + * @param signature + * @param point + * @param request + * @return + */ + private void internalAppAuth(MethodSignature signature, JoinPoint point, HttpServletRequest request) { + String authorization = request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY); + BaseTokenDto tokenDTO = getTokenDTO(authorization); + + Map tokenMap = redisUtils.hGetAll(RedisKeys.getCpUserKey(tokenDTO.getApp(), tokenDTO.getClient(), tokenDTO.getUserId())); + BaseTokenDto baseTokenDto = null; + String customerId; + if ("gov".equals(tokenDTO.getApp())) { + GovTokenDto govTokenDto = BeanUtil.mapToBean(tokenMap, GovTokenDto.class, true); + customerId = govTokenDto.getCustomerId(); + baseTokenDto = govTokenDto; + } else { + TokenDto tokenDto = BeanUtil.mapToBean(tokenMap, TokenDto.class, true); + customerId = tokenDto.getCustomerId(); + baseTokenDto = tokenDTO; + } + + if (baseTokenDto == null) { + logger.error("内部应用认证,redis中没有找到登录缓存信息"); + throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg()); + } + + if (!authorization.equals(baseTokenDto.getToken())) { + logger.error("内部应用认证,redis中找到的token与header里面传入的不一致,可能发生了别处登录"); + throw new RenException(EpmetErrorCode.ERR10007.getCode(), EpmetErrorCode.ERR10007.getMsg()); + } + + // header参数赋值 + Parameter[] parameters = signature.getMethod().getParameters(); + if (parameters != null && parameters.length != 0) { + for (int i = 0; i < parameters.length; i++) { + if (parameters[i].getType() == ExternalAppRequestParam.class) { + ExternalAppRequestParam requestParam = (ExternalAppRequestParam) point.getArgs()[i]; + requestParam.setCustomerId(customerId); + } + } + } + + } + + private BaseTokenDto getTokenDTO(String authorization) { + if (StringUtils.isBlank(authorization)) { + logger.error("内部应用认证,没有携带authorization头信息"); + throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg()); + } + + //是否过期 + Claims claims = jwtTokenUtils.getClaimByToken(authorization); + if (claims == null) { + logger.error("内部应用认证,Claims为空"); + throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg()); + } + + if (jwtTokenUtils.isTokenExpired(claims.getExpiration())) { + logger.error("内部应用认证,token过期"); + throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg()); + } + + //获取用户ID + String app = (String) claims.get("app"); + String client = (String) claims.get("client"); + String userId = (String) claims.get("userId"); + return new BaseTokenDto(app, client, userId, authorization); + } + + /** + * 外部应用认证 + * + * @param signature + * @param point + */ + public void extAppAuth(MethodSignature signature, JoinPoint point, HttpServletRequest request) { String token = request.getHeader(ACCESS_TOKEN_HEADER_KEY); String appId = request.getHeader(APP_ID_HEADER_KEY); String ts = request.getHeader(APP_ID_TIMESTAMP_KEY); @@ -89,7 +203,6 @@ public class ExternalAppRequestAuthAspect { // header参数赋值 - MethodSignature signature = (MethodSignature) point.getSignature(); Parameter[] parameters = signature.getMethod().getParameters(); if (parameters != null && parameters.length != 0) { for (int i = 0; i < parameters.length; i++) { diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java new file mode 100644 index 0000000000..8c7dcc2636 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenProperties.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.commons.extappauth.jwt; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * Jwt + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Configuration +@ConfigurationProperties(prefix = "jwt.token") +public class JwtTokenProperties { + private String secret; + private int expire; + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public int getExpire() { + return expire; + } + + public void setExpire(int expire) { + this.expire = expire; + } +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java new file mode 100644 index 0000000000..bd5eff1beb --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/jwt/JwtTokenUtils.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.extappauth.jwt; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Jwt工具类 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class JwtTokenUtils { + private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class); + + @Autowired + private JwtTokenProperties jwtProperties; + + /** + * 生成jwt token 弃用 + */ + @Deprecated + public String generateToken(String userId) { + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setSubject(userId) + .setIssuedAt(new Date()) + .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) + .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) + .compact(); + } + + public Claims getClaimByToken(String token) { + try { + return Jwts.parser() + .setSigningKey(jwtProperties.getSecret()) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + + /** + * @return java.util.Date + * @param token + * @Author yinzuomei + * @Description 获取token的有效期截止时间 + * @Date 2020/3/18 22:17 + **/ + public Date getExpiration(String token){ + try { + return Jwts.parser() + .setSigningKey(jwtProperties.getSecret()) + .parseClaimsJws(token) + .getBody().getExpiration(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + + /** + * @param map + * @return java.lang.String + * @Author yinzuomei + * @Description 根据app+client+userId生成token + * @Date 2020/3/18 22:29 + **/ + public String createToken(Map map) { + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(map) + .setIssuedAt(new Date()) + .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) + .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) + .compact(); + } + + /** + * token是否过期 + * + * @return true:过期 + */ + public boolean isTokenExpired(Date expiration) { + return expiration.before(new Date()); + } + + public static void main(String[] args) { + Map map=new HashMap<>(); + map.put("app","gov"); + map.put("client","wxmp"); + map.put("userId","100526ABC"); + String tokenStr=Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(map) + .setIssuedAt(new Date()) + .setExpiration(DateTime.now().plusSeconds(604800).toDate()) + .signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") + .compact(); + System.out.println(tokenStr); + Claims claims= Jwts.parser() + .setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") + .parseClaimsJws(tokenStr) + .getBody(); + System.out.println("app="+ claims.get("app")); + System.out.println("client="+ claims.get("client")); + System.out.println("userId="+ claims.get("userId")); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 20a0b534f6..3417d172d8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -95,7 +95,6 @@ public enum EpmetErrorCode { SIGN_IN_TIME_NO(8513, "签到时间还未到~"), SIGN_IN_TIME_END(8514, "签到时间已结束~"), - // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), OPER_ADD_CUSTOMER_ROOT_AGENCY_EXISTS(8703, "添加客户根级组织失败,根级组织已存在"), @@ -108,6 +107,7 @@ public enum EpmetErrorCode { OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"), OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"), OPER_EXT_APP_SECRET_RESET_FAIL(8713, "秘钥更新失败"), + UNSUPPORT_AUTH_TYPE(8714, "不支持的认证方式"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java deleted file mode 100644 index a16df89c2a..0000000000 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.epmet.controller.test; - -import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; -import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; -import com.epmet.commons.tools.utils.Result; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("test") -public class TestController { - - @ExternalAppRequestAuth - @RequestMapping("/test") - public Result test(ExternalAppRequestParam externalAppRequestParam, String ext) { - return new Result().ok("调用成功,客户信息:"+externalAppRequestParam); - } - -} From f63d4374618448e2197179e6879bb43769c9dd99 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 23 Sep 2020 15:00:11 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=86=85=E9=83=A8=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E8=AE=A4=E8=AF=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aspect/ExternalAppRequestAuthAspect.java | 9 +++++++-- .../epmet/commons/tools/exception/EpmetErrorCode.java | 1 - .../controller/screen/KcScreenController.java | 2 ++ .../src/main/resources/bootstrap.yml | 10 +++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java index 079440664b..060b882cf5 100644 --- a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -82,10 +83,10 @@ public class ExternalAppRequestAuthAspect { } else if (signature.getMethod().getAnnotation(InternalAppRequestAuth.class) != null && StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY))) { // 走内部应用认证 - String customerId = null; internalAppAuth(signature, point, request); } else { - throw new RenException(EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getCode(), EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getMsg()); + logger.error("根据header无法找到适用的认证方式"); + throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg()); } } @@ -101,6 +102,10 @@ public class ExternalAppRequestAuthAspect { BaseTokenDto tokenDTO = getTokenDTO(authorization); Map tokenMap = redisUtils.hGetAll(RedisKeys.getCpUserKey(tokenDTO.getApp(), tokenDTO.getClient(), tokenDTO.getUserId())); + if (CollectionUtils.isEmpty(tokenMap)) { + logger.error("内部应用认证,redis中没有找到登录缓存信息"); + throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg()); + } BaseTokenDto baseTokenDto = null; String customerId; if ("gov".equals(tokenDTO.getApp())) { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 1c1e6ae20b..e4832a1c8b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -110,7 +110,6 @@ public enum EpmetErrorCode { OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"), OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"), OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"), - UNSUPPORT_AUTH_TYPE(8715, "不支持的认证方式"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), 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 210c950e78..c56c3e8df8 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,6 +1,7 @@ package com.epmet.datareport.controller.screen; import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -75,6 +76,7 @@ public class KcScreenController { * @return */ @ExternalAppRequestAuth + @InternalAppRequestAuth @PostMapping("issue/summary") public Result getIssueSummary(ExternalAppRequestParam externalAppRequestParam) { String customerId = externalAppRequestParam.getCustomerId(); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml index d3ebec947d..34d40361e4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml @@ -140,4 +140,12 @@ pagehelper: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + + +jwt: + token: + #秘钥 + secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet] + #token有效时长,默认7天,单位秒 + expire: 604800 \ No newline at end of file From 0d739010ac4a36118f429a6de1bbfe28737b0a51 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 23 Sep 2020 15:14:38 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E7=9A=84=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/form/AblityIndexFormDTO.java | 34 +++ .../screen/dto/form/AblityListFormDTO.java | 42 ++++ .../dto/form/MonthAblityListFormDTO.java | 43 ++++ .../dto/form/MonthScoreListFormDTO.java | 33 +++ .../dto/form/PeerComparisonFormDTO.java | 39 +++ .../screen/dto/form/RootAgencyFormDTO.java | 25 ++ .../screen/dto/form/ScoreListFormDTO.java | 38 +++ .../dto/result/AblityIndexResultDTO.java | 51 ++++ .../dto/result/AblityListResultDTO.java | 29 +++ .../dto/result/MonthAblityListResultDTO.java | 25 ++ .../dto/result/MonthScoreListResultDTO.java | 48 ++++ .../dto/result/PeerComparisonResultDTO.java | 29 +++ .../dto/result/RootAgencyResultDTO.java | 26 ++ .../screen/dto/result/ScoreListResultDTO.java | 33 +++ .../datareport/constant/FactConstant.java | 36 +++ .../controller/fact/FactIndexController.java | 107 ++++++++ .../screen/ScreenCustomerAgencyDao.java | 6 + .../screen/ScreenIndexDataMonthlyDao.java | 13 +- .../dao/fact/FactIndexAgencyScoreDao.java | 39 +++ .../dao/fact/FactIndexAgencySubScoreDao.java | 51 ++++ .../fact/FactIndexCommunitySubScoreDao.java | 51 ++++ .../service/fact/FactIndexService.java | 63 +++++ .../fact/impl/FactIndexServiceImpl.java | 235 ++++++++++++++++++ .../mapper/fact/FactIndexAgencyScoreDao.xml | 10 + .../fact/FactIndexAgencySubScoreDao.xml | 42 ++++ .../fact/FactIndexCommunitySubScoreDao.xml | 42 ++++ .../mapper/screen/ScreenCustomerAgencyDao.xml | 11 + .../screen/ScreenIndexDataMonthlyDao.xml | 58 +++++ 28 files changed, 1255 insertions(+), 4 deletions(-) create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java create mode 100644 epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java new file mode 100644 index 0000000000..66da4e0e9e --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 能力指数--接口入参 + * @Author sun + */ +@Data +public class AblityIndexFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String monthId; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java new file mode 100644 index 0000000000..f1c4221482 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月查询各项指标数据--接口入参 + * @Author sun + */ +@Data +public class AblityListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String monthId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @NotBlank(message = "类型不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String indexCode; + /** + * 所有有权重的指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java new file mode 100644 index 0000000000..365fdb2000 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月查询各项指标最近12个月数据--接口入参 + * @Author sun + */ +@Data +public class MonthAblityListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String monthId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "类型key不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String key; + /** + * 查询月份的前12个月对应的monthId + */ + private String startMonthId; + public interface AddUserInternalGroup {} + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java new file mode 100644 index 0000000000..3efeee665f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 能力指数--接口入参 + * @Author sun + */ +@Data +public class MonthScoreListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String monthId; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java new file mode 100644 index 0000000000..2d0b69bd2f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 同级对比各项数据查询--接口入参 + * @Author sun + */ +@Data +public class PeerComparisonFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @NotBlank(message = "数据类型不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String indexCode; + /** + * 查询条数 + */ + @Min(value = 1, message = "查询条数必须大于0", groups = {PeerComparisonFormDTO.AddUserInternalGroup.class }) + private Integer pageSize; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java new file mode 100644 index 0000000000..97355373a3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 是否根组织--接口入参 + * @Author sun + */ +@Data +public class RootAgencyFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class}) + private String agencyId; + + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java new file mode 100644 index 0000000000..ea430fa0a7 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月份查询各项能力分数--接口入参 + * @Author sun + */ +@Data +public class ScoreListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) + private String monthId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + private String indexCode; + + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java new file mode 100644 index 0000000000..d50bcdc137 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 能力指数--接口返参 + * @Author sun + */ +@Data +public class AblityIndexResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli + */ + private String indexCode; + /** + * 每项能力最近12月各项分数对象 + */ + private List scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + + + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java new file mode 100644 index 0000000000..2df53bff05 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月查询各项指标数据--接口返参 + * @Author sun + */ +@Data +public class AblityListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 各项指标名称 + */ + private String name; + /** + * 指标对应值(数值或百分比) + */ + private String value = "0"; + /** + * 各项指标对应key值(index_dict字典表) + */ + private String key; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java new file mode 100644 index 0000000000..86e9372e78 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月查询各项指标最近12个月数据--接口返参 + * @Author sun + */ +@Data +public class MonthAblityListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 横坐标(202009) + */ + private String monthId; + /** + * 指标对应值(数值或百分比) + */ + private String ablity; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java new file mode 100644 index 0000000000..c40628cdd4 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 按月份查询各项能力最近12个月得分--接口返参 + * @Author sun + */ +@Data +public class MonthScoreListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli + */ + private String indexCode; + /** + * 每项能力最近12月各项分数对象 + */ + private List scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java new file mode 100644 index 0000000000..95e9545a8c --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 同级对比各项数据查询--接口返参 + * @Author sun + */ +@Data +public class PeerComparisonResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 组织Id + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * 能力分值(保留一位小数) + */ + private Double score; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java new file mode 100644 index 0000000000..910e56eaa3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 是否根组织--接口返参 + * @Author sun + */ +@Data +public class RootAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 是否根组织(是:true 否:false) + */ + private Boolean isRoot = true; + + /** + * 数据更新至(上月月末时间) + */ + private String date; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java new file mode 100644 index 0000000000..9672f58bfe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月份查询各项能力分数--接口返参 + * @Author sun + */ +@Data +public class ScoreListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + private String indexCode; + /** + * 总分(保留一位小数) + */ + private Double indexTotal; + /** + * 本级分数(保留一位小数) + */ + private Double agencyScore; + /** + * 下级分数(保留一位小数) + */ + private Double subAgencyScore; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java new file mode 100644 index 0000000000..529563feb2 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java @@ -0,0 +1,36 @@ +package com.epmet.datareport.constant; + +/** + * @author sun + * @dscription 数据 + */ +public interface FactConstant { + /** + * 能力指标 + */ + String NLZB = "nenglizhibiao"; + /** + * 党建能力 + */ + String DJNL = "dangjiannengli"; + /** + * 治理能力 + */ + String ZLNL = "zhilinengli"; + /** + * 服务能力 + */ + String FWNL = "fuwunengli"; + /** + * 全区相关 + */ + String QUAN_QU_XIANG_GUAN = "quanquxiangguan"; + /** + * 街道相关 + */ + String JIE_DAO_XIANG_GUAN = "jiedaoxiangguan"; + /** + * 社区相关 + */ + String SHE_QU_XIANG_GUAN = "shequxiangguan"; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java new file mode 100644 index 0000000000..4399756545 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java @@ -0,0 +1,107 @@ +package com.epmet.datareport.controller.fact; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.fact.FactIndexService; +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 数据改版api + * @author sun + */ +@RestController +@RequestMapping("fact") +public class FactIndexController { + + @Autowired + private FactIndexService factIndexService; + + /** + * @param tokenDTO + * @Description 能力指数 + * @author sun + */ + @PostMapping("index/ablityindex") + public Result> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityIndex(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + @PostMapping("index/scorelist") + public Result> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.scoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + @PostMapping("index/monthscorelist") + public Result> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthScoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @PostMapping("index/ablitylist") + public Result> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + @PostMapping("index/monthablitylist") + public Result> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthAblityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + @PostMapping("index/peercomparison") + public Result> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.peerComparison(formDTO)); + } + + /** + * @param tokenDTO + * @Description 是否根组织 + * @author sun + */ + @PostMapping("index/rootagency") + public Result rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class); + return new Result().ok(factIndexService.rootAgency(formDTO)); + } + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 17c48ae989..88aaf3ae2f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -80,4 +80,10 @@ public interface ScreenCustomerAgencyDao { */ List selectParymemberDistribution(@Param("parentId")String parentId); + /** + * @param agencyId + * @Description 根据组织ID判断是否根组织 + * @author sun + */ + int selectRootAgency(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index 6448f9902b..c64d8dbef9 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -19,11 +19,9 @@ package com.epmet.datareport.dao.evaluationindex.screen; import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO; import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO; import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO; -import com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO; -import com.epmet.evaluationindex.screen.dto.result.MonthBarchartResult; -import com.epmet.evaluationindex.screen.dto.result.MonthPieChartResultDTO; -import com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO; +import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -79,4 +77,11 @@ public interface ScreenIndexDataMonthlyDao{ * @return */ List selectIndexRankByOrgType(GridIndexRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + * @author sun + */ + List selectScoreList(PeerComparisonFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java new file mode 100644 index 0000000000..0ca569e995 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexAgencyScoreDao { + + /** + * @param formDTO + * @Description 分别查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @author sun + */ + ScoreListResultDTO selectScore(ScoreListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java new file mode 100644 index 0000000000..0fd8e29c06 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.LinkedList; +import java.util.List; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexAgencySubScoreDao { + + /** + * @param formDTO + * @Description 查询区县级、乡镇街道级组织某月份某项能力对应的各项指标 + * @author sun + */ + List selectAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询区县级、乡镇街道级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java new file mode 100644 index 0000000000..1689ab0b3c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.LinkedList; +import java.util.List; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexCommunitySubScoreDao { + + /** + * @param formDTO + * @Description 查询社区级组织某一月份某项能力对应的各项指标 + * @author sun + */ + List selectCommunityAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询社区级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java new file mode 100644 index 0000000000..475549a522 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java @@ -0,0 +1,63 @@ +package com.epmet.datareport.service.fact; + +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; + +import java.util.List; + +/** + * 数据改版api + * @author sun + */ +public interface FactIndexService { + + /** + * @param formDTO + * @Description 能力指数 + * @author sun + */ + List ablityIndex(AblityIndexFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + List scoreList(ScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + List monthScoreList(MonthScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + List ablityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + List monthAblityList(MonthAblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + List peerComparison(PeerComparisonFormDTO formDTO); + + /** + * @param formDTO + * @Description 是否根组织 + * @author sun + */ + RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO); + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java new file mode 100644 index 0000000000..52a9fe1d7a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -0,0 +1,235 @@ +package com.epmet.datareport.service.fact.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.constant.FactConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; +import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao; +import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; +import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; +import com.epmet.datareport.service.fact.FactIndexService; +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 数据改版api + * + * @author sun + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class FactIndexServiceImpl implements FactIndexService { + + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; + @Autowired + private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; + @Autowired + private FactIndexAgencyScoreDao factIndexAgencyScoreDao; + @Autowired + private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao; + @Autowired + private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao; + + /** + * @param formDTO + * @Description 能力指数 + * @author sun + */ + @Override + public List ablityIndex(AblityIndexFormDTO formDTO) { + LinkedList resultDTO = new LinkedList<>(); + //分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序 + //1.查询组织过去12个月党建能力指标 + //LinkedList djList = factIndexAgencyScoreDao.; + LinkedList djList = null; + //2.查询组织过去12个月治理能力指标 + LinkedList zlList = null; + //3.查询组织过去12个月服务能力指标 + LinkedList fwList = null; + //4.遍历计算每个月能力指数 + LinkedList nlList = new LinkedList<>(); + for (int i = 0; i < djList.size(); i++) { + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + nldto.setIndexTotal(djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal()); + nldto.setAgencyScore(djList.get(i).getAgencyScore() + zlList.get(i).getAgencyScore() + fwList.get(i).getAgencyScore()); + nldto.setSubAgencyScore(djList.get(i).getSubAgencyScore() + zlList.get(i).getSubAgencyScore() + fwList.get(i).getSubAgencyScore()); + nldto.setMonthId(djList.get(i).getMonthId()); + nlList.add(nldto); + } + //5.封装数据并返回 + AblityIndexResultDTO nl = new AblityIndexResultDTO(); + nl.setIndexCode(FactConstant.NLZB); + nl.setScoreList(djList); + resultDTO.add(nl); + AblityIndexResultDTO dj = new AblityIndexResultDTO(); + dj.setIndexCode(FactConstant.DJNL); + dj.setScoreList(djList); + resultDTO.add(dj); + AblityIndexResultDTO zl = new AblityIndexResultDTO(); + zl.setIndexCode(FactConstant.ZLNL); + zl.setScoreList(djList); + resultDTO.add(zl); + AblityIndexResultDTO fw = new AblityIndexResultDTO(); + fw.setIndexCode(FactConstant.FWNL); + fw.setScoreList(djList); + resultDTO.add(fw); + + return resultDTO; + } + + /** + * @param formDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + @Override + public List scoreList(ScoreListFormDTO formDTO) { + //1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 + formDTO.setIndexCode(FactConstant.DJNL); + ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO); + //2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 + //3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 + + return null; + } + + /** + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + @Override + public List monthScoreList(MonthScoreListFormDTO formDTO) { + return null; + } + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @Override + public List ablityList(AblityListFormDTO formDTO) { + List resultList = new ArrayList<>(); + //按月份查询当前组织各项指标数据 fact_index_agency_sub_score + //1.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); + if (null == agency) { + throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getAgencyId())); + } + //2.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + if ("district".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } else { + formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } + resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO); + } else { + throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + } + //3.调用方法判断各项指标是数字指标还是百分比指标 //TODO + return resultList; + } + + /** + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + @Override + public List monthAblityList(MonthAblityListFormDTO formDTO) { + LinkedList resultList = new LinkedList<>(); + //1.计算所查月份前12个月的monthId + formDTO.setStartMonthId(getDate(formDTO.getMonthId())); + //2.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); + if (null == agency) { + throw new RenException(String.format("查询到组织信息失败,组织Id:%s", formDTO.getAgencyId())); + } + + //3.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO); + } else { + throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + } + //3.调用方法判断各项指标是数字指标还是百分比指标//TODO + return resultList; + } + + public String getDate(String newDate) { + String date = ""; + SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); + try { + Calendar ds = Calendar.getInstance(); + ds.setTime(sdf.parse(newDate)); + ds.add(Calendar.YEAR, -1); + date = sdf.format(ds.getTime()); + } catch (RenException | ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * @param formDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + @Override + public List peerComparison(PeerComparisonFormDTO formDTO) { + //1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + List resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO); + return resultList; + } + + /** + * @param formDTO + * @Description 是否根组织 + * @author sun + */ + @Override + public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) { + RootAgencyResultDTO resultDTO = new RootAgencyResultDTO(); + //1.根据agencyId查询是否为根级组织 + int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId()); + if (num < NumConstant.ONE) { + resultDTO.setIsRoot(false); + } + //2.计算统计数据更新时间 + SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + //获取当前月第一天日期 + calendar.add(Calendar.MONTH, 0); + calendar.set(Calendar.DAY_OF_MONTH, 1); + //获取上月最后一天日期 + calendar.set(Calendar.HOUR, -24); + resultDTO.setDate(d.format(calendar.getTime())); + + return resultDTO; + } + +} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml new file mode 100644 index 0000000000..4ecea63f0a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml new file mode 100644 index 0000000000..db62b6c918 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml new file mode 100644 index 0000000000..324fbb8a13 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 22a62be6d0..932149d9c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -101,4 +101,15 @@ AND sutd.parent_id = #{parentId} + + \ No newline at end of file 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 36b89ffefe..d244c92906 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 @@ -105,4 +105,62 @@ ORDER BY index_total DESC LIMIT #{topNum} + + From 8664d1cd6539040ca319f0f959a9236eb593f923 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 23 Sep 2020 15:21:40 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=B8=80=E4=BD=8D=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/screen/ScreenIndexDataMonthlyDao.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 d244c92906..029828fb15 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 @@ -111,13 +111,13 @@ org_id AS "agencyId", org_name AS "agencyName", - round((party_dev_ablity * party_dev_weight),2) AS "score" + round((party_dev_ablity * party_dev_weight),1) AS "score" - round((govern_ablity * govern_ablity_weight),2) AS "score" + round((govern_ablity * govern_ablity_weight),1) AS "score" - round((service_ablity * service_ablity_weight),2) AS "score" + round((service_ablity * service_ablity_weight),1) AS "score" FROM screen_index_data_monthly From 6ab0dbd04904692f9c09a0281aa265193e32e00f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Sep 2020 16:24:13 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=85=9A=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/DemoController.java | 4 +- .../screen/ScreenCustomerAgencyDao.java | 9 ++ .../screen/ScreenCustomerGridDao.java | 10 ++ .../impl/PartyBaseInfoServiceImpl.java | 97 +++++++++++++------ .../screen/ScreenCustomerAgencyService.java | 9 ++ .../screen/ScreenCustomerGridService.java | 10 ++ .../impl/ScreenCpcBaseDataServiceImpl.java | 3 + .../impl/ScreenCustomerAgencyServiceImpl.java | 12 +++ .../impl/ScreenCustomerGridServiceImpl.java | 13 +++ .../screen/ScreenCpcBaseDataDao.xml | 6 +- .../screen/ScreenCustomerAgencyDao.xml | 16 +++ .../screen/ScreenCustomerGridDao.xml | 16 +++ 12 files changed, 168 insertions(+), 37 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 4c3b670b57..f88786d11e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -637,8 +637,8 @@ public class DemoController { private PartyBaseInfoService partyBaseInfoService; @PostMapping("zxczxczxc") - public Result getZxcZxcZxc(){ - partyBaseInfoService.statsPartyMemberBaseInfoToScreen("45687aa479955f9d06204d415238f7cc","20200922"); + public Result getZxcZxcZxc(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ + partyBaseInfoService.statsPartyMemberBaseInfoToScreen(formDTO.getCustomerId(),formDTO.getDateId()); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 9eb43a08a3..65f2faf3b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.result.TreeResultDTO; import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO; @@ -143,4 +144,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectSubAgencyId(@Param("agencyId") String agencyId,@Param("customerId") String customerId); + + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/23 3:10 下午 + */ + List selectAllAgencyIdToParty(@Param("customerId")String customerId,@Param("dateId")String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index 5e49d15e0c..28338f0da7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.screencoll.form.CustomerGridFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; @@ -128,4 +129,13 @@ public interface ScreenCustomerGridDao extends BaseDao ScreenCustomerGridEntity getLastUpdateGrid(); ScreenCustomerGridEntity getByGridId(String gridId); + + /** + * @Description 查询客户下所有网格ID + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/23 3:10 下午 + */ + List selectAllGridIdToParty(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java index 6829d7182c..050b8df4ce 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java @@ -9,10 +9,13 @@ import com.epmet.dto.extract.result.UserCountResultDTO; import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService; import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.stats.DimCustomerPartymemberService; import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService; import com.epmet.service.stats.user.FactParticipationUserGridDailyService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -39,6 +42,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { @Autowired private ScreenCustomerAgencyService agencyService; @Autowired + private ScreenCustomerGridService gridService; + @Autowired private DimCustomerPartymemberService partyMemberService; @Autowired private FactParticipationUserGridDailyService userGridDailyService; @@ -62,20 +67,22 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ List customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY); disPose(customerGridInfoList,true,customerId,dateId); - }else if (groupByLevel.containsKey(ScreenConstant.STREET)){ + } + if (groupByLevel.containsKey(ScreenConstant.STREET)){ List customerGridInfoList = groupByLevel.get(ScreenConstant.STREET); disPose(customerGridInfoList,false,customerId,dateId); - }else if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + } + if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ List customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT); disPose(customerGridInfoList,false,customerId,dateId); - }else if (groupByLevel.containsKey(ScreenConstant.CITY)){ + } + if (groupByLevel.containsKey(ScreenConstant.CITY)){ List customerGridInfoList = groupByLevel.get(ScreenConstant.CITY); disPose(customerGridInfoList,false,customerId,dateId); - }else if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + } + if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ List customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE); disPose(customerGridInfoList,false,customerId,dateId); - }else { - // TODO 干啥 } } return true; @@ -89,6 +96,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { */ public void disPose(List agencyIdList, Boolean isGrid, String customerId, String dateId){ if (!CollectionUtils.isEmpty(agencyIdList)){ + List orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List result = new ArrayList<>(); if (isGrid == true){ List userCountList = userGridDailyService.selectUserCount(customerId, dateId); @@ -97,6 +105,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { String agencyId = agency.getAgencyId(); Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); List gridIds = (List) agencyMap.get(agencyId); + orgIds.addAll(gridIds); List partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); if (!CollectionUtils.isEmpty(partyMemberInfoList)){ // 为每个人赋值年龄 @@ -137,6 +146,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); form.setOrgName(party.get(NumConstant.ZERO).getOrgName()); form.setOrgId(commAgencyId); + form.setCustomerId(customerId); + form.setDataEndTime(dateId); form.setOrgType(ScreenConstant.AGENCY); form.setParentId(party.get(NumConstant.ZERO).getParentId()); form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1))); @@ -150,30 +161,32 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); result.add(form); }); - delAndInsert(result,customerId,dateId); + delAndInsert(result,customerId,dateId,orgIds); }else { - List userCountRList = userAgencyDailyService.selectUserCount(customerId, dateId); agencyIdList.forEach(agency -> { String agencyId = agency.getAgencyId(); - // todo List partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId); - PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); - form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); - form.setOrgId(agencyId); - form.setOrgType(ScreenConstant.AGENCY); - form.setParentId(partyInfoList.get(NumConstant.ZERO).getParentId()); - form.setAgeLevel1(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel1))); - form.setAgeLevel2(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel2))); - form.setAgeLevel3(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel3))); - form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); - form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); - form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); - form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); - form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); - form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); - result.add(form); + if (!CollectionUtils.isEmpty(partyInfoList)){ + PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); + form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); + form.setOrgId(agencyId); + form.setCustomerId(customerId); + form.setDataEndTime(dateId); + form.setOrgType(ScreenConstant.AGENCY); + form.setParentId(partyInfoList.get(NumConstant.ZERO).getParentId()); + form.setAgeLevel1(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel1))); + form.setAgeLevel2(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel2))); + form.setAgeLevel3(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel3))); + form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); + form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); + form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); + form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); + form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); + form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); + result.add(form); + } }); - delAndInsert(result,customerId,dateId); + delAndInsert(result,customerId,dateId,orgIds); } } } @@ -246,14 +259,34 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { * @date 2020/9/23 10:13 上午 */ @Transactional(rollbackFor = Exception.class) - public void delAndInsert(List result, String customerId, String dateId){ + public void delAndInsert(List result, String customerId, String dateId, List orgIds){ + List partyBaseInfoList = agencyService.selectAllAgencyIdToParty(customerId,dateId); + List resultList = gridService.selectAllGridIdToParty(customerId, dateId); + resultList.addAll(partyBaseInfoList); + List finalResult = new ArrayList<>(); + resultList.forEach(rl -> { + orgIds.forEach(orgId -> { + if (rl.getOrgId().equals(orgId)){ + finalResult.add(rl); + } + }); + }); if (!CollectionUtils.isEmpty(result)){ - List orgIds = result.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); - Integer delNum; - do { - delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds); - }while (delNum > NumConstant.ZERO); - cpcBaseDataService.insertPartyBaseInfo(result); + finalResult.forEach(fr -> { + result.forEach(r -> { + if (fr.getOrgId().equals(r.getOrgId())){ + BeanUtils.copyProperties(r,fr); + } + }); + }); } + Integer delNum; + do { + delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds); + }while (delNum > NumConstant.ZERO); + List> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + cpcBaseDataService.insertPartyBaseInfo(p); + }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 43af0f75f3..6d955563f7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import java.util.List; @@ -66,4 +67,12 @@ public interface ScreenCustomerAgencyService{ * @date 2020/9/23 11:11 上午 */ List selectSubAgencyId(String agencyId, String customerId); + + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/23 3:10 下午 + */ + List selectAllAgencyIdToParty(String customerId,String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index d12238c077..504af8521d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -19,6 +19,7 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; @@ -36,4 +37,13 @@ public interface ScreenCustomerGridService extends BaseService grids2Add, List grids2Update); + + /** + * @Description 查询客户下所有网格ID + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/23 3:10 下午 + */ + List selectAllGridIdToParty(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java index 8f6ebc9a15..ab1e25f294 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java @@ -17,7 +17,9 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenCpcBaseDataDao; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.result.PartyInfoResultDTO; @@ -35,6 +37,7 @@ import java.util.List; * @since v1.0.0 2020-09-22 */ @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenCpcBaseDataServiceImpl extends BaseServiceImpl implements ScreenCpcBaseDataService { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 398c416acb..cf159bae2f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.result.TreeResultDTO; import com.epmet.constant.ScreenConstant; @@ -147,6 +148,17 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ return screenCustomerAgencyDao.selectSubAgencyId(agencyId, customerId); } + /** + * @Description 查询客户下所有机关ID + * @param customerId + * @author zxc + * @date 2020/9/23 3:10 下午 + */ + @Override + public List selectAllAgencyIdToParty(String customerId,String dateId) { + return screenCustomerAgencyDao.selectAllAgencyIdToParty(customerId,dateId); + } + private void updateAgency(ScreenCustomerAgencyEntity exists) { screenCustomerAgencyDao.updateById(exists); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index a2922cbc19..2d25673a50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; @@ -89,4 +90,16 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectAllGridIdToParty(String customerId, String dateId) { + return screenCustomerGridDao.selectAllGridIdToParty(customerId, dateId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml index 74f4551aec..7700490255 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml @@ -120,10 +120,10 @@ UPDATED_BY, UPDATED_TIME ) values - + ( REPLACE(UUID(), '-', ''), - #{customerId}, + #{item.customerId}, #{item.orgType}, #{item.orgId}, #{item.parentId}, @@ -156,7 +156,7 @@ and DATA_END_TIME = #{dateId} and ( - + org_id = #{orgId} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 1da83a86be..1a66ff709b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -270,4 +270,20 @@ AND CUSTOMER_ID = #{customerId} AND PID = #{agencyId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 3a15aae8e7..419674a89d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -217,4 +217,20 @@ where DEL_FLAG = 0 and GRID_ID = #{gridId} + + + From 5857c6cb5832919a652ce3fce6fd3750c3e13d93 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 23 Sep 2020 16:58:02 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=87=AA=E8=BA=AB?= =?UTF-8?q?=E5=92=8C=E4=B8=8B=E7=BA=A7=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/config/DynamicDataSource.java | 2 +- .../com/epmet/controller/DemoController.java | 4 +- ...oreDao.java => AgencySelfSubScoreDao.java} | 8 ++- ...Dao.java => CommunitySelfSubScoreDao.java} | 2 +- ...ScoreDao.java => GridSelfSubScoreDao.java} | 8 ++- .../impl/GridCorreLationServiceImpl.java | 52 ++++++++++++++--- .../src/main/resources/bootstrap.yml | 8 +-- .../indexcal/AgencySelfSubScoreDao.xml | 40 +++++++++++++ ...reDao.xml => CommunitySelfSubScoreDao.xml} | 2 +- .../indexcal/FactIndexGridSelfSubScoreDao.xml | 29 ---------- .../indexcal/GridSelfSubScoreDao.xml | 58 +++++++++++++++++++ .../indexcal/GridSubScoreDao.xml | 2 +- 12 files changed, 167 insertions(+), 48 deletions(-) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/{FactIndexAgencySelfSubScoreDao.java => AgencySelfSubScoreDao.java} (76%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/{FactIndexCommunitySelfSubScoreDao.java => CommunitySelfSubScoreDao.java} (91%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/{FactIndexGridSelfSubScoreDao.java => GridSelfSubScoreDao.java} (74%) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml rename epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/{FactIndexCommunitySelfSubScoreDao.xml => CommunitySelfSubScoreDao.xml} (92%) delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml 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 62939c595f..a70cac86ae 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(); - logger.info("动态数据源:{}" + ds); + logger.debug("动态数据源:{}", ds); return ds; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index f88786d11e..2f5ca2657b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -178,13 +178,13 @@ public class DemoController { @PostMapping("zxc2") public Result getZxc2(){ - indexCalculateCommunityService.calCommunityAll("b09527201c4409e19d1dbc5e3c3429a1","202008"); + indexCalculateCommunityService.calCommunityAll("epmettest", "202008"); return new Result(); } @PostMapping("testcalculategridcorrelation") public Result testcalculateGridCorreLation(){ - CalculateCommonFormDTO formDTO=new CalculateCommonFormDTO("b09527201c4409e19d1dbc5e3c3429a1","202008"); + CalculateCommonFormDTO formDTO = new CalculateCommonFormDTO("epmettest", "202008"); gridCorreLationService.calculateGridCorreLation(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java similarity index 76% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java index be0033d735..6d7cd81e19 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexAgencySelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java @@ -20,6 +20,9 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 区/街道相关 自身和下级分数表 @@ -28,6 +31,9 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexAgencySelfSubScoreDao extends BaseDao { +public interface AgencySelfSubScoreDao extends BaseDao { + + int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId); + int insertBatch(@Param("list") List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java similarity index 91% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java index 2c4dec2bf4..02323576b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexCommunitySelfSubScoreDao extends BaseDao { +public interface CommunitySelfSubScoreDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/GridSelfSubScoreDao.java similarity index 74% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/GridSelfSubScoreDao.java index d6ee6208ab..684ad99a31 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/GridSelfSubScoreDao.java @@ -20,6 +20,9 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 网格相关自身/下级分值记录表 @@ -28,6 +31,9 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-09-21 */ @Mapper -public interface FactIndexGridSelfSubScoreDao extends BaseDao { +public interface GridSelfSubScoreDao extends BaseDao { + + int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("parentIndexCode") String parentIndexCode); + int insertBatch(@Param("list") List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index 2037c86fb1..798809e2bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcal.CpcScoreDao; import com.epmet.dao.evaluationindex.indexcal.GridScoreDao; +import com.epmet.dao.evaluationindex.indexcal.GridSelfSubScoreDao; import com.epmet.dao.evaluationindex.indexcal.GridSubScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao; @@ -19,8 +20,8 @@ import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.*; -import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; import com.epmet.eum.IndexCodeEnum; @@ -75,6 +76,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { private GridSubScoreDao gridSubScoreDao; @Autowired private IndexGroupDetailDao indexGroupDetailDao; + @Autowired + private GridSelfSubScoreDao gridSelfSubScoreDao; /** @@ -122,22 +125,57 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } - Map selfSubParentMap = new HashMap<>(); + Map> selfSubParentMap = new HashMap<>(); + selfSubParentMap.put("zishen", new HashSet<>()); + selfSubParentMap.put("xiaji", new HashSet<>()); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllParentIndexCode().contains("xiaji")) { - selfSubParentMap.put(o.getAllParentIndexCode(), "xiaji"); + if (o.getAllIndexCodePath().indexOf("xiaji") > -1) { + selfSubParentMap.get("xiaji").add(o.getIndexCode()); } else { - selfSubParentMap.put(o.getAllParentIndexCode(), "zishen"); + selfSubParentMap.get("zishen").add(o.getIndexCode()); } }); - Map insertList = new HashMap<>(); + Map insertMap = new HashMap<>(); subScore.forEach(score -> { - insertList.get(score.getAllParentIndexCode()); + + String key = score.getGridId().concat(index.getIndexCode()); + GridSelfSubScoreEntity scoreEntity = insertMap.get(key); + if (scoreEntity == null) { + scoreEntity = ConvertUtils.sourceToTarget(score, GridSelfSubScoreEntity.class); + insertMap.put(key, scoreEntity); + scoreEntity.setSelfScore(new BigDecimal(0)); + scoreEntity.setSubScore(new BigDecimal(0)); + scoreEntity.setParentIndexCode(index.getIndexCode()); + scoreEntity.setSelfWeight(new BigDecimal(0)); + scoreEntity.setSubWeight(new BigDecimal(0)); + } + BigDecimal partScore = score.getScore().multiply(score.getWeight()); + BigDecimal partWeight = score.getScore().multiply(score.getWeight()); + if (selfSubParentMap.get("xiaji").contains(score.getIndexCode())) { + scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore)); + scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight())); + } else { + scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore)); + scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight())); + } + log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getGridId(), score.getScore(), score.getWeight(), partScore); + System.out.println("=====grid:" + score.getGridId() + ",originScore:" + score.getScore() + ",weight:" + score.getWeight() + ",finalScore:" + partScore + " ,selftotal:" + scoreEntity.getSelfScore() + ",subScore:" + scoreEntity.getSubScore()); }); + deleteAndInsertSelfSubScore(formDTO, index.getIndexCode(), insertMap); }); } + @Transactional(rollbackFor = Exception.class) + public void deleteAndInsertSelfSubScore(CalculateCommonFormDTO formDTO, String indexCode, Map insertMap) { + int effectRow = 0; + do { + gridSelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode); + } while (effectRow > 0); + + gridSelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values())); + } + /** * @param formDTO * @return void diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index ccb02b714f..0772838230 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -189,7 +189,7 @@ thread: queueCapacity: @thread.pool.queue-capacity@ keepAlive: @thread.pool.keep-alive@ -dingTalk: - robot: - webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ +#dingTalk: +# robot: +# webHook: @dingTalk.robot.webHook@ +# secret: @dingTalk.robot.secret@ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml new file mode 100644 index 0000000000..9df88e8cd4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml @@ -0,0 +1,40 @@ + + + + + + + delete from fact_index_agency_self_sub_score limit 1000 + + + + INSERT INTO fact_index_agency_self_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, + DATA_TYPE, SELF_SCORE, SUB_SCORE, PARENT_INDEX_CODE,ALL_PARENT_INDEX_CODE, + SELF_WEIGHT,SUB_WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.agencyId}, + #{item.parentAgencyId}, + #{item.yearId}, + #{item.quarterId}, + #{item.monthId}, + #{item.dataType}, + #{item.selfScore}, + #{item.subScore}, + #{item.parentIndexCode}, + #{item.allParentIndexCode}, + #{item.selfWeight}, + #{item.subWeight}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + NOW(), + #{item.updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml similarity index 92% rename from epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml rename to epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml index f97b98ce61..ec000e7116 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexCommunitySelfSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml @@ -1,7 +1,7 @@ - + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml deleted file mode 100644 index ea015c53c0..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/FactIndexGridSelfSubScoreDao.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml new file mode 100644 index 0000000000..cb7a33fc47 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSelfSubScoreDao.xml @@ -0,0 +1,58 @@ + + + + + + delete from fact_index_grid_self_sub_score where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND MONTH_ID = #{monthId,jdbcType=VARCHAR} AND PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR} limit 1000 + + + + INSERT INTO `fact_index_grid_self_sub_score` ( + `ID`, + `CUSTOMER_ID`, + `GRID_ID`, + `AGENCY_ID`, + `ALL_PARENT_IDS`, + `QUARTER_ID`, + `YEAR_ID`, + `MONTH_ID`, + `SELF_SCORE`, + `SUB_SCORE`, + `PARENT_INDEX_CODE`, + `ALL_PARENT_INDEX_CODE`, + `SELF_WEIGHT`, + `SUB_WEIGHT`, + `DEL_FLAG`, + `REVISION`, + `CREATED_BY`, + `CREATED_TIME`, + `UPDATED_BY`, + `UPDATED_TIME` + ) + VALUES + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.allParentIds}, + #{item.quarterId}, + #{item.yearId}, + #{item.monthId}, + #{item.selfScore}, + #{item.subScore}, + #{item.parentIndexCode}, + #{item.allParentIndexCode}, + #{item.selfWeight}, + #{item.subWeight}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml index d04a0356d5..63f4c618e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml @@ -82,7 +82,7 @@ `ALL_PARENT_INDEX_CODE`, WEIGHT FROM - fact_index_grid_score + fact_index_grid_sub_score WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} From 243f9e8ef5a92e45be04da67d8f2df4f3e4d7c7c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Sep 2020 17:14:52 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E6=8A=BD=E5=8F=96?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/extract/result/IssueProcessInfoResultDTO.java | 3 +++ .../extract/FactOriginIssueMainDailyDao.java | 10 ++++++++++ .../extract/todata/impl/IssueExtractServiceImpl.java | 7 +++++++ .../extract/FactOriginIssueMainDailyDao.xml | 7 +++++++ .../src/main/resources/mapper/issue/StatsIssueDao.xml | 5 ++++- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java index 5d9bbb0cf2..f3dd236dee 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.extract.result; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -42,4 +43,6 @@ public class IssueProcessInfoResultDTO implements Serializable { * 用户ID */ private String userId; + + private Date createTime; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index 5ef3c02f02..4b4f6204ab 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -110,4 +110,14 @@ public interface FactOriginIssueMainDailyDao extends BaseDao topicIdList); + + /** + * @Description 更新议题状态 + * @param issueId + * @param status + * @author zxc + * @date 2020/9/23 5:08 下午 + */ + void updateIssueStatus(@Param("issueId")String issueId,@Param("status")String status); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index 8d090d614b..22e33b1503 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.extract.todata.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.TimeListResultDTO; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; @@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -165,6 +167,11 @@ public class IssueExtractServiceImpl implements IssueExtractService { log.warn("issueExtractMain issueExtractLog return empty,customerId:{},dateId:{}", customerId, dateId); return true; } + Map> groupByIssue = listResult.stream().collect(Collectors.groupingBy(IssueProcessInfoResultDTO::getIssueId)); + groupByIssue.forEach((issueId,process) -> { + List descByCreateTime = process.stream().sorted(Comparator.comparing(IssueProcessInfoResultDTO::getCreateTime).reversed()).collect(Collectors.toList()); + issueMainDailyDao.updateIssueStatus(issueId,descByCreateTime.get(NumConstant.ZERO).getActionCode()); + }); listResult.forEach(issueProcess -> { IssueLogDailyFormDTO issueLogDailyFormDTO = ConvertUtils.sourceToTarget(issueProcess, IssueLogDailyFormDTO.class); issueLogDailyFormDTO.setOperationUserId(issueProcess.getUserId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index e65c1ff8b8..7e9829a221 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -59,6 +59,13 @@ + + + update fact_origin_issue_main_daily + set ISSUE_STATUS = #{status} + where id = #{issueId} + + DELETE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index f38b7a5715..e226e3964d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -209,7 +209,9 @@ + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml new file mode 100644 index 0000000000..10756a9e75 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml new file mode 100644 index 0000000000..4ff2a2b66c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml new file mode 100644 index 0000000000..ff7c0031c7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -0,0 +1,7 @@ + + + + + + + From 7dde2c65c95aa2a7f9e8f569e22f8dd48dd5c5a5 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 23 Sep 2020 17:52:20 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8B=E7=BA=A7?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=9A=84=E6=95=B0=E6=8D=AE=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=9C=88=E4=BB=BD=E6=9D=A1=E4=BB=B6=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=BB=84=E7=BB=87=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...O.java => SubAgencyIndexRankYMFormDTO.java} | 17 ++++++++++++----- .../AnNingSubAgencyIndexRankResultDTO.java | 5 +++++ .../controller/screen/IndexController.java | 11 +++++++---- .../screen/ScreenIndexDataMonthlyDao.java | 4 ++-- .../screen/ScreenIndexDataYearlyDao.java | 4 ++-- .../evaluationindex/screen/IndexService.java | 4 ++-- .../screen/impl/IndexServiceImpl.java | 18 +++++++++++------- .../screen/ScreenIndexDataMonthlyDao.xml | 10 ++++++---- .../mapper/screen/ScreenIndexDataYearlyDao.xml | 5 +++-- 9 files changed, 50 insertions(+), 28 deletions(-) rename epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/{AnNingSubAgencyIndexRankFormDTO.java => SubAgencyIndexRankYMFormDTO.java} (63%) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java similarity index 63% rename from epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java index 683aebbe7c..fc7e43593e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AnNingSubAgencyIndexRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java @@ -8,20 +8,22 @@ import java.io.Serializable; /** * 5、下级部门指数排行(安宁数据段用) 入参 + * * @Author zhangyong * @DateTime 2020/09/08 9:54 */ @Data -public class AnNingSubAgencyIndexRankFormDTO implements Serializable { +public class SubAgencyIndexRankYMFormDTO implements Serializable { private static final long serialVersionUID = -2920561669035794486L; - public interface SubAgencyIndexRank{} + public interface SubAgencyIndexRank { + } /** * 机关ID */ - @NotBlank(message = "组织id不能为空",groups = {SubAgencyIndexRank.class}) + @NotBlank(message = "组织id不能为空", groups = {SubAgencyIndexRank.class}) private String agencyId; /** @@ -33,12 +35,17 @@ public class AnNingSubAgencyIndexRankFormDTO implements Serializable { /** * asc 正序, desc 降序 */ - @NotNull(message = "排序方式不能为空",groups = {SubAgencyIndexRank.class}) + @NotNull(message = "排序方式不能为空", groups = {SubAgencyIndexRank.class}) private String sort; /** * 年度:year 月度:month */ - @NotNull(message = "年度、月度不能为空",groups = {SubAgencyIndexRank.class}) + @NotNull(message = "年度、月度不能为空", groups = {SubAgencyIndexRank.class}) private String type; + + /** + * 月份Id + */ + private String monthId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java index f93b98b16d..c4653c9a71 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AnNingSubAgencyIndexRankResultDTO.java @@ -42,4 +42,9 @@ public class AnNingSubAgencyIndexRankResultDTO implements Serializable { * 组织id或者网格id */ private String orgId = ""; + + /** + * 组织类型 + */ + private String orgType = ""; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index f2a7ebd151..162065563b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java @@ -1,6 +1,7 @@ package com.epmet.datareport.controller.screen; import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.annotation.InternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -82,17 +83,19 @@ public class IndexController { } /** - * 5、下级部门指数排行(安宁数据段用) + * 5、下级部门指数排行(安宁数据段用) + * * @param formDTO * @return com.epmet.commons.tools.utils.Result> * @Author zhangyong * @Date 13:39 2020-09-11 **/ + @InternalAppRequestAuth @ExternalAppRequestAuth @PostMapping("dataclient/subagencyindexrank") - public Result> anNingSubAgencyIndexRank(@RequestBody AnNingSubAgencyIndexRankFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, AnNingSubAgencyIndexRankFormDTO.SubAgencyIndexRank.class); - return new Result>().ok(indexService.anNingSubAgencyIndexRank(formDTO)); + public Result> getSubAgencyIndexRank(@RequestBody SubAgencyIndexRankYMFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, SubAgencyIndexRankYMFormDTO.SubAgencyIndexRank.class); + return new Result>().ok(indexService.getSubAgencyIndexRank(formDTO)); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index c64d8dbef9..3374c24026 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -17,10 +17,10 @@ package com.epmet.datareport.dao.evaluationindex.screen; -import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO; import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO; import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO; import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -68,7 +68,7 @@ public interface ScreenIndexDataMonthlyDao{ * @Author zhangyong * @Date 09:38 2020-09-08 **/ - List selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List selectSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO); /** * desc:获取网格指标排行 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java index 70f0f1b5a6..4300b76ea3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java @@ -17,7 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; -import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO; import com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO; import com.epmet.evaluationindex.screen.dto.result.YearAverageIndexResultDTO; import org.apache.ibatis.annotations.Mapper; @@ -50,5 +50,5 @@ public interface ScreenIndexDataYearlyDao{ * @Author zhangyong * @Date 09:38 2020-09-08 **/ - List selectAnNingSubAgencyIndexYearlyRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List selectAnNingSubAgencyIndexYearlyRank(SubAgencyIndexRankYMFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java index a7742172d9..21b6bd2554 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java @@ -46,14 +46,14 @@ public interface IndexService { List subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO); /** - * 5、下级部门指数排行(安宁数据段用) + * 5、按月或年 下级组织指数排行 * * @param formDTO * @return java.util.List * @Author zhangyong * @Date 09:38 2020-09-08 **/ - List anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO); + List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO); /** * desc:获取该客户下网格排行 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 7777739c0c..087034645d 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 @@ -6,7 +6,6 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao; import com.epmet.datareport.service.evaluationindex.screen.IndexService; -import com.epmet.datareport.utils.DateUtils; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; @@ -19,6 +18,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.Comparator; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -39,7 +39,7 @@ public class IndexServiceImpl implements IndexService { @Autowired private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl; @Autowired - private DateUtils dateUtils; + private com.epmet.datareport.utils.DateUtils dateUtils; /** * @Description 1、年度平均指数 @@ -204,16 +204,20 @@ public class IndexServiceImpl implements IndexService { return subAgencyIndexRankResultDTOS; } - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override - public List anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO) { + public List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO) { List subAgencyIndexRankResultDTOS = new ArrayList<>(); - if (ScreenConstant.YEAR_ID.equals(formDTO.getType())){ + if (ScreenConstant.YEAR_ID.equals(formDTO.getType())) { // 年 指数排行 subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectAnNingSubAgencyIndexYearlyRank(formDTO); - } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())){ + } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())) { // 月(上一个月) 指数排行 - subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectAnNingSubAgencyIndexMonthlyRank(formDTO); + if (StringUtils.isBlank(formDTO.getMonthId())) { + String monthId = com.epmet.commons.tools.utils.DateUtils.format(com.epmet.commons.tools.utils.DateUtils.addDateMonths(new Date(), -1), "yyyyMMdd"); + formDTO.setMonthId(monthId); + } + subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyOrGridIndexMonthlyRank(formDTO); subAgencyIndexRankResultDTOS.forEach(rank -> { rank.setPartyDevAbility(getRound(rank.getPartyDevAbility())); rank.setGovernAbility(getRound(rank.getGovernAbility())); 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 029828fb15..0676fb2177 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 @@ -61,21 +61,23 @@ LIMIT #{topNum} - - SELECT org_name AS `NAME`, service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility, party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility, govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility, - ORG_ID orgId + ORG_ID orgId, + ORG_TYPE orgType FROM screen_index_data_monthly WHERE del_flag = '0' AND parent_id = #{agencyId} - AND month_id = left(replace(DATE_SUB( CURDATE(),INTERVAL 1 MONTH),'-',''),6) + AND month_id = #{monthId,jdbcType=VARCHAR} + AND ORG_TYPE != 'department' ORDER BY index_total ASC diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml index 4aeae5361a..6c0ebfb5e8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml @@ -19,14 +19,15 @@ -