From 8ebe8b6b731bf7393f10f26ee8512432d3b0b40b Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 31 Aug 2020 10:08:53 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90fact=5Findex=5Fcpc=5Fscore?=
 =?UTF-8?q?=E3=80=81fact=5Findex=5Fgrid=5Fscore?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../com/epmet/dao/indexscore/CpcScoreDao.java | 33 +++++++
 .../epmet/dao/indexscore/GridScoreDao.java    | 33 +++++++
 .../entity/indexscore/CpcScoreEntity.java     | 87 ++++++++++++++++++
 .../entity/indexscore/GridScoreEntity.java    | 92 +++++++++++++++++++
 .../impl/GridCorreLationServiceImpl.java      | 47 +++++++---
 .../mapper/indexscore/CpcScoreDao.xml         | 26 ++++++
 .../mapper/indexscore/GridScoreDao.xml        | 27 ++++++
 7 files changed, 333 insertions(+), 12 deletions(-)
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.java
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.java
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.java
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml
 create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.java
new file mode 100644
index 0000000000..74628e78e8
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.java
@@ -0,0 +1,33 @@
+/**
+ * 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.dao.indexscore;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.indexscore.CpcScoreEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 党员相关分值
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-31
+ */
+@Mapper
+public interface CpcScoreDao extends BaseDao {
+	
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.java
new file mode 100644
index 0000000000..77de72959f
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.java
@@ -0,0 +1,33 @@
+/**
+ * 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.dao.indexscore;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.indexscore.GridScoreEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 网格相关分值
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-31
+ */
+@Mapper
+public interface GridScoreDao extends BaseDao {
+	
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java
new file mode 100644
index 0000000000..59c4269a3b
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java
@@ -0,0 +1,87 @@
+/**
+ * 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.indexscore;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 党员相关分值
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-31
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("fact_index_cpc_score")
+public class CpcScoreEntity extends BaseEpmetEntity {
+
+	private static final long serialVersionUID = 1L;
+
+    /**
+     * 客户Id
+     */
+	private String customerId;
+
+    /**
+     * 网格所属的机关Id
+     */
+	private String agencyId;
+
+    /**
+     * 网格Id
+     */
+	private String gridId;
+
+    /**
+     * 用户id
+     */
+	private String userId;
+
+    /**
+     * 月维度Id: yyyyMM
+     */
+	private String monthId;
+
+    /**
+     * 党建能力分值
+     */
+	private BigDecimal partyAblityScore;
+
+    /**
+     * 参与议事分值
+     */
+	private BigDecimal joinIssueScore;
+
+    /**
+     * 党务活动分值
+     */
+	private BigDecimal partyWorkActScore;
+
+    /**
+     * 联系群众分值
+     */
+	private BigDecimal contactMassesScore;
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.java
new file mode 100644
index 0000000000..3b4b4c44c9
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.java
@@ -0,0 +1,92 @@
+/**
+ * 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.indexscore;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 网格相关分值
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-31
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("fact_index_grid_score")
+public class GridScoreEntity extends BaseEpmetEntity {
+
+	private static final long serialVersionUID = 1L;
+
+    /**
+     * 客户Id
+     */
+	private String customerId;
+
+    /**
+     * 网格Id
+     */
+	private String gridId;
+
+    /**
+     * 网格所属的机关Id
+     */
+	private String agencyId;
+
+    /**
+     * 季度ID
+     */
+	private String quarterId;
+
+    /**
+     * 年度ID
+     */
+	private String yearId;
+
+    /**
+     * 月维度Id: yyyyMM
+     */
+	private String monthId;
+
+    /**
+     * 总指数分值
+     */
+	private BigDecimal totalScore;
+
+    /**
+     * 党建能力分值
+     */
+	private BigDecimal partyAblityScore;
+
+    /**
+     * 治理能力分值
+     */
+	private BigDecimal govrnAblityScore;
+
+    /**
+     * 服务能力分值
+     */
+	private BigDecimal serviceAblityScore;
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
index 8b052d2638..d06d57ee21 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
@@ -136,12 +136,13 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
                         SampleValue currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr));
                         value.getIndexValueVOs().add(currentGridIndexValue);
                     } else if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) {
-                        //组织内党员的联系群众能力考评分(平均值) TODO
-                        logger.info("组织内党员的联系群众能力考评分(平均值) TODO");
+                        //组织内党员的联系群众能力考评分(平均值)
+                        logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
                         //网格内党员的联系群众能力考评分(平均值)
-                       /* BigDecimal contactResiAblity = null;
-                        SampleValue contactResiAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactResiAblity);
-                        value.getIndexValueVOs().add(contactResiAblityValue);*/
+                        String gridId=(String) recordMap.get(IndexCalConstant.GRID_ID);
+                        BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(gridId);
+                        SampleValue contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgValue);
+                        value.getIndexValueVOs().add(contactMassesAblityValue);
                     }
                 });
             });
@@ -162,6 +163,29 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
         }
     }
 
+    /**
+     * @return java.util.Map
+     * @param formDTO
+     * @author yinzuomei
+     * @description TODO
+     * @Date 2020/8/31 9:51
+     **/
+    private Map contactMassesAblityMap(CalculateCommonFormDTO formDTO) {
+
+        return null;
+    }
+
+    /**
+     * @return java.math.BigDecimal
+     * @param gridId 网格id
+     * @author yinzuomei  TODO
+     * @description 获取网格(组织)内党员的联系群众能力考评分(平均值)
+     * @Date 2020/8/31 9:50
+     **/
+    private BigDecimal getGridContactMassesAvgValue(String gridId) {
+        return null;
+    }
+
     /**
      * @param formDTO           客户id   月份id:  yyyyMM
      * @param indexList         指标集合
@@ -230,12 +254,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
             BigDecimal minValue = null;
             BigDecimal maxValue = null;
             if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(index.getIndexCode())) {
-                //组织内党员的联系群众能力考评分(平均值) TODO  获取最大值,最小值
-                logger.info("组织内党员的联系群众能力考评分(平均值) TODO");
-                /*Map contactResiAblityMap=;
-                minValue=contactResiAblityMap.get(StrConstant.MIN);
-                maxValue=contactResiAblityMap.get(StrConstant.MAX);*/
-                continue;
+                //组织内党员的联系群众能力考评分(平均值)  获取最大值,最小值
+                logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
+                Map contactMassesAblityMap= this.contactMassesAblityMap(formDTO);
+                minValue=contactMassesAblityMap.get(StrConstant.MIN);
+                maxValue=contactMassesAblityMap.get(StrConstant.MAX);
             } else {
                 //获取指标对应的列名
                 String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode());
@@ -267,7 +290,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
     /**
      * @param formDTO
      * @param indexList
-     * @return void
+     * @return void TODO
      * @author yinzuomei
      * @description 计算网格相关-治理能力
      * @Date 2020/8/26 16:47
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml
new file mode 100644
index 0000000000..3a17dcc82b
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+    
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+    
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml
new file mode 100644
index 0000000000..4b1d7f6fcc
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+    
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+    
+
+
+
\ No newline at end of file