From 95d8c395cb3e5ebe8aa4f230c2d0e9af2bd55a76 Mon Sep 17 00:00:00 2001
From: zhangyongzhangyong <2012005003@qq.coom>
Date: Fri, 4 Sep 2020 09:37:37 +0800
Subject: [PATCH] =?UTF-8?q?Merge=20branch=20'dev=5Fscreen=5Fdata'=20of=20C?=
=?UTF-8?q?:\Users\Administrator\Desktop\=E5=85=9A=E7=BE=A4e=E4=BA=8B?=
=?UTF-8?q?=E9=80=9A=E5=90=8E=E7=AB=AF=20with=20conflicts.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
epmet-gateway/pom.xml | 4 +-
.../dto/screen/FactIndexGridScoreDTO.java | 18 +-
.../data-statistical-server/pom.xml | 4 +-
.../com/epmet/constant/OrgTypeConstant.java | 33 ++
.../FactIndexCollectController.java | 24 +-
.../indexcal/AgencyScoreDao.java | 13 +-
.../indexcal/DeptScoreDao.java | 18 +-
.../screen/FactIndexCommunityScoreDao.java | 13 +-
.../screen/FactIndexGridScoreDao.java | 32 +-
.../screen/ScreenCustomerAgencyDao.java | 11 +
.../screen/ScreenCustomerDeptDao.java | 10 +
.../screen/ScreenCustomerGridDao.java | 10 +
.../indexcoll/FactIndexCollectService.java | 10 +
.../impl/FactIndexCollectServiceImpl.java | 332 ++++++++++++++++++
.../indexcal/AgencyScoreDao.xml | 21 +-
.../evaluationindex/indexcal/DeptScoreDao.xml | 20 +-
.../screen/FactIndexCommunityScoreDao.xml | 20 +-
.../screen/FactIndexGridScoreDao.xml | 21 +-
.../screen/ScreenCustomerAgencyDao.xml | 10 +
.../screen/ScreenCustomerDeptDao.xml | 11 +
.../screen/ScreenCustomerGridDao.xml | 12 +
21 files changed, 619 insertions(+), 28 deletions(-)
create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml
index 66279bb8ad..796a1e9880 100644
--- a/epmet-gateway/pom.xml
+++ b/epmet-gateway/pom.xml
@@ -181,8 +181,8 @@
lb://data-report-server
- lb://data-statistical-server
-
+
+ http://localhost:8108
lb://epmet-openapi-scan
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
index 6590da34cb..4d26f40f48 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
@@ -60,24 +60,24 @@ public class FactIndexGridScoreDTO implements Serializable {
private String monthId;
/**
- * 总指数分值
+ * 年维度Id: yyyy
*/
- private BigDecimal totalScore;
+ private String yearId;
/**
- * 党建能力分值
+ * 1:总分;0不是;默认0
*/
- private BigDecimal partyAblityScore;
+ private String isTotal;
/**
- * 治理能力分值
+ * 分值
*/
- private BigDecimal govrnAblityScore;
+ private BigDecimal score;
/**
- * 服务能力分值
+ * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;网格相关(前三者之和):wanggexiangguan
*/
- private BigDecimal serviceAblityScore;
+ private String indexCode;
/**
* 删除标识 0未删除;1已删除
@@ -109,4 +109,4 @@ public class FactIndexGridScoreDTO implements Serializable {
*/
private Date updatedTime;
-}
\ No newline at end of file
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml
index 8a76d00116..3746a65446 100644
--- a/epmet-module/data-statistical/data-statistical-server/pom.xml
+++ b/epmet-module/data-statistical/data-statistical-server/pom.xml
@@ -201,7 +201,7 @@
6379
123456
- true
+ false
192.168.1.130:8848
6ceab336-d004-4acf-89c6-e121d06f4988
@@ -416,4 +416,4 @@
-
\ No newline at end of file
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
new file mode 100644
index 0000000000..95919792d9
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.constant;
+
+/**
+ * 组织类别 常量
+ *
+ * @author sun
+ * @since 1.0.0
+ */
+public interface OrgTypeConstant {
+
+ /**
+ * 部门
+ */
+ String DEPARTMENT = "department";
+
+ /**
+ * 网格
+ */
+ String GRID = "grid";
+
+ /**
+ * 组织
+ */
+ String AGENCY = "agency";
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java
index eaa7c921b1..21a81701ac 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java
@@ -4,12 +4,10 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcollect.form.*;
+import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -153,4 +151,22 @@ public class FactIndexCollectController {
factIndexCollectService.insertDeptGovrnAbility(formDTO, externalAppRequestParam.getCustomerId());
return new Result();
}
+
+ public static void main(String[] args) {
+ String a = "202009";
+ System.out.println(a.substring(0,4));
+ System.out.println(a.substring(4,6));
+
+ int[] aa = new int[2];
+ System.out.println(aa[0]);
+ System.out.println(aa == null);
+ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
+ System.out.println(monthlyFormDTO.getIndexTotal());
+ }
+
+ @GetMapping("hahaha")
+ public Result hahaha(String monthId, String customerId) {
+ factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(monthId, customerId);
+ return new Result();
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
index 5c6a90ad02..219d617a0d 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
@@ -27,7 +27,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
- * 区/街道相关分数表
+ * 区/街道相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
@@ -62,4 +62,13 @@ public interface AgencyScoreDao extends BaseDao {
*/
List selectStreetInfo(@Param("customerId") String customerId, @Param("monthId")String monthId,@Param("dataType")String dataType);
-}
\ No newline at end of file
+ /**
+ * 根据入参查询 区/街道相关分数表 记录
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
index 4f670bbfe2..0718e44771 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
@@ -18,8 +18,12 @@
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 区直部门分值表
@@ -29,5 +33,15 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface DeptScoreDao extends BaseDao {
-
-}
\ No newline at end of file
+
+ /**
+ * 根据入参查询 区直部门分值表 记录
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListDeptScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java
index 1df4f962b5..a6060a2bf7 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java
@@ -29,7 +29,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
- * 社区相关分数表
+ * 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-31
@@ -64,6 +64,15 @@ public interface FactIndexCommunityScoreDao extends BaseDao selectCommunityInfo(@Param("customerId") String customerId,@Param("monthId")String monthId);
+ /**
+ * 根据入参查询 查询社区相关信息
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListCommunityScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 街道下级所有社区得分平均值
* @param customerId
@@ -73,4 +82,4 @@ public interface FactIndexCommunityScoreDao extends BaseDao selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
-}
\ No newline at end of file
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java
index b1271f13f1..1736cb88fe 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java
@@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.screen.FactIndexGridScoreDTO;
import com.epmet.dto.screen.result.SubGridGovernAvgResultDTO;
import com.epmet.dto.screen.result.SubGridAvgResultDTO;
import com.epmet.dto.screen.result.SubGridServiceAvgResultDTO;
@@ -44,4 +45,33 @@ public interface FactIndexGridScoreDao extends BaseDao
* @date 2020/8/28 3:20 下午
*/
List selectSubGridAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
-}
\ No newline at end of file
+ List selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId);
+
+ /**
+ * @Description 社区下属所有网格治理能力汇总平均值
+ * @param customerId
+ * @param monthId
+ * @author zxc
+ * @date 2020/8/31 9:19 上午
+ */
+ List selectSubGridGovernAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
+ /**
+ * @Description 社区下级所有网格服务能力得分平均值
+ * @param customerId
+ * @param monthId
+ * @author zxc
+ * @date 2020/8/31 1:51 下午
+ */
+ List selectSubGridServiceAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
+ /**
+ * 根据入参查询 网格相关分值记录
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListGridScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+}
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 f0d189f7ea..20147e0f82 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
@@ -55,4 +55,15 @@ public interface ScreenCustomerAgencyDao extends BaseDao list, @Param("customerId")String customerId);
+
+ /**
+ * 根据客户id、组织id,查询区/街道 组织名称
+ *
+ * @param customerId 客户id
+ * @param agencyId 组织id
+ * @return java.util.String
+ * @Author zhangyong
+ * @Date 16:57 2020-09-03
+ **/
+ String selectParentAgencyInfo(@Param("customerId")String customerId, @Param("agencyId")String agencyId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
index aedd720c25..7cfb17110c 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
@@ -58,6 +58,16 @@ public interface ScreenCustomerDeptDao extends BaseDao
**/
void batchInsertCustomerDept(@Param("list") List list, @Param("customerId")String customerId);
+ /**
+ * 根据客户id、部门id,查询部门父级 信息
+ * @param customerId 客户id
+ * @param deptId 部门id
+ * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity
+ * @Author zhangyong
+ * @Date 16:57 2020-09-03
+ **/
+ ScreenCustomerDeptEntity selectParentDeptInfo(@Param("customerId")String customerId, @Param("deptId")String deptId);
+
/**
* @param customerId
* @param deptId
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 4254712cbf..0d9a6420f9 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
@@ -94,4 +94,14 @@ public interface ScreenCustomerGridDao extends BaseDao
* @Date 2020/8/31 12:35
**/
ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId);
+
+ /**
+ * 根据客户id、网格id,查询网格(党支部)父级信息
+ * @param customerId
+ * @param gridId
+ * @return com.epmet.dto.screen.FactIndexGridScoreDTO
+ * @Author zhangyong
+ * @Date 16:57 2020-09-03
+ **/
+ ScreenCustomerGridDTO selectParentGridInfo(@Param("customerId")String customerId, @Param("gridId")String gridId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java
index 3e29d51f57..8f6197ffcd 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java
@@ -107,4 +107,14 @@ public interface FactIndexCollectService {
* @Date 10:52 2020-08-20
**/
void insertDeptGovrnAbility(List formDTO, String customerId);
+
+ /**
+ * 将网格、社区、区直部门、区/街道分支记录表中的数据,抽取到 指数-指数数据(每月数值) 指数-指数数据(按年统计)
+ * @param monthId 2020-8
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 10:29 2020-09-03
+ **/
+ void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
index e8ec5f9342..26c725cf4d 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
@@ -3,14 +3,31 @@ package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
+import com.epmet.constant.OrgTypeConstant;
+import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
+import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.*;
+import com.epmet.dao.evaluationindex.screen.*;
+import com.epmet.dto.ScreenCustomerGridDTO;
+import com.epmet.dto.indexcal.AgencyScoreDTO;
+import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.dto.indexcollect.form.*;
+import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
+import com.epmet.dto.screen.FactIndexGridScoreDTO;
+import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
+import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
+import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity;
+import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
/**
* @Auther: zhangyong
@@ -36,6 +53,24 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao;
@Autowired
private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao;
+ @Autowired
+ private FactIndexGridScoreDao factIndexGridScoreDao;
+ @Autowired
+ private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
+ @Autowired
+ private DeptScoreDao deptScoreDao;
+ @Autowired
+ private AgencyScoreDao agencyScoreDaol;
+ @Autowired
+ private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
+ @Autowired
+ private ScreenIndexDataYearlyDao screenIndexDataYearlyDao;
+ @Autowired
+ private ScreenCustomerGridDao screenCustomerGridDao;
+ @Autowired
+ private ScreenCustomerDeptDao screenCustomerDeptDao;
+ @Autowired
+ private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@@ -160,4 +195,301 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO, customerId);
}
}
+
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) {
+ if (NumConstant.SIX != monthId.length()){
+ throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId);
+ }
+ String year = monthId.substring(NumConstant.ZERO, NumConstant.FOUR);
+ String month = monthId.substring(NumConstant.FOUR, NumConstant.SIX);
+
+ // fact_index_grid_score 网格相关分值记录表 grid
+ List gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId);
+ if (null != gridScoreDTOS && gridScoreDTOS.size() > NumConstant.ZERO){
+ this.insertIndexDataMonthlyByGridScore(month, year, customerId, gridScoreDTOS);
+ }
+
+ // fact_index_community_score 社区相关分数表 agency
+ List communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId);
+ if (null != communityScoreDTOS && communityScoreDTOS.size() > NumConstant.ZERO){
+ this.insertIndexDataMonthlyByCommunityScore(month, year, customerId, communityScoreDTOS);
+ }
+
+ // fact_index_dept_score 区直部门分值表 department
+ List deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId);
+ if (null != deptScoreDTOS && deptScoreDTOS.size() > NumConstant.ZERO){
+ this.insertIndexDataMonthlyByDeptScore(month, year, customerId, deptScoreDTOS);
+ }
+
+ // fact_index_agency_score 区/街道相关分数表 agency
+ List agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId);
+ if (null != agencyScoreDTOS && agencyScoreDTOS.size() > NumConstant.ZERO) {
+ this.insertIndexDataMonthlyByAgencyScore(month, year, customerId, agencyScoreDTOS);
+ }
+
+ // 插入年表 screen_index_data_yearly
+ }
+
+ /**
+ * 将网格相关分值记录表 数据 插入月表 screenIndexDataMonthlyDao
+ *
+ * @param month 08
+ * @param year 2020
+ * @param customerId 客户id
+ * @param gridScoreDTOS 网格相关分值记录表 当前客户所属月份数据集
+ * @return void
+ * @Author zhangyong
+ * @Date 14:17 2020-09-03
+ **/
+ private void insertIndexDataMonthlyByGridScore(String month, String year, String customerId, List gridScoreDTOS){
+ List monthlyFormDTOList = new ArrayList<>();
+ // 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
+ Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId));
+ String[] orgIds = new String[collect.size()];
+ int j = 0;
+ for(Map.Entry> gridScore : collect.entrySet()){
+ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
+ // 网格id
+ orgIds[j] = gridScore.getKey();
+ j++;
+ for ( int i = 0; i < gridScore.getValue().size(); i++){
+ if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){
+ // 是总分
+ if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())){
+ // 总指数 = 网格相关
+ monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore());
+ }
+ } else {
+ // 赋值 党建能力、治理能力、服务能力
+ monthlyFormDTO = this.setValueAblityMonthlyFor(gridScore.getValue().get(i).getIndexCode(),
+ gridScore.getValue().get(i).getScore(),
+ monthlyFormDTO);
+ }
+ }
+ // 查询网格的 上级组织id 和 组织名称
+ ScreenCustomerGridDTO parentGridInfo = screenCustomerGridDao.selectParentGridInfo(customerId, gridScore.getKey());
+ if (null == parentGridInfo){
+ throw new RuntimeException("在screen_customer_grid表中未查询到该客户下的网格信息:customerId =" + customerId + ", gridId = " + gridScore.getKey());
+ }
+ // 补充表中其他字段
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, gridScore.getKey(),
+ parentGridInfo.getParentAgencyId(), parentGridInfo.getGridName(), monthlyFormDTO);
+ monthlyFormDTOList.add(monthlyFormDTO);
+ }
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+
+ /**
+ * 社区相关分数表 数据 插入月表 screenIndexDataMonthlyDao
+ *
+ * @param month 08
+ * @param year 2020
+ * @param customerId 客户id
+ * @param communityScoreDTOS 社区相关分数表 当前客户所属月份数据集
+ * @return void
+ * @Author zhangyong
+ * @Date 14:17 2020-09-03
+ **/
+ private void insertIndexDataMonthlyByCommunityScore(String month, String year, String customerId, List communityScoreDTOS){
+ List monthlyFormDTOList = new ArrayList<>();
+ // 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据
+ Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
+ String[] orgIds = new String[collect.size()];
+ int j = 0;
+ for(Map.Entry> communityScore : collect.entrySet()){
+ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
+ // 组织id
+ orgIds[j] = communityScore.getKey();
+ j++;
+ for ( int i = 0; i < communityScore.getValue().size(); i++){
+ if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){
+ // 是总分
+ if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())){
+ // 总指数 = 社区相关
+ monthlyFormDTO.setIndexTotal(communityScore.getValue().get(i).getScore());
+ }
+ } else {
+ // 赋值 党建能力、治理能力、服务能力
+ monthlyFormDTO = this.setValueAblityMonthlyFor(communityScore.getValue().get(i).getIndexCode(),
+ communityScore.getValue().get(i).getScore(),
+ monthlyFormDTO);
+ }
+ }
+
+ // 当前组织 的上级组织id
+ String parentAgencyId = communityScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
+ // 查询 组织名称
+ String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, communityScore.getKey());
+ if (null == agencyName){
+ throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey());
+ }
+ // 补充表中其他字段
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, communityScore.getKey(),
+ parentAgencyId, agencyName, monthlyFormDTO);
+ // 补充表中其他字段
+ monthlyFormDTOList.add(monthlyFormDTO);
+ }
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+
+ /**
+ * 将区直部门分值表 数据 插入月表 screenIndexDataMonthlyDao
+ *
+ * @param month 08
+ * @param year 2020
+ * @param customerId 客户id
+ * @param deptScoreDTOS 区直部门分值表 当前客户所属月份数据集
+ * @return void
+ * @Author zhangyong
+ * @Date 14:17 2020-09-03
+ **/
+ private void insertIndexDataMonthlyByDeptScore(String month, String year, String customerId, List deptScoreDTOS){
+ List monthlyFormDTOList = new ArrayList<>();
+ // 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据
+ Map> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId));
+ String[] orgIds = new String[collect.size()];
+ int j = 0;
+ for(Map.Entry> deptScore : collect.entrySet()){
+ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
+ // 部门id
+ orgIds[j] = deptScore.getKey();
+ j++;
+ for ( int i = 0; i < deptScore.getValue().size(); i++){
+ if (NumConstant.ONE_STR.equals(deptScore.getValue().get(i).getIsTotal())){
+ // 是总分 总指数 = IS_TOTAL = 1
+ monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore());
+ } else {
+ // 赋值 党建能力、治理能力、服务能力
+ monthlyFormDTO = this.setValueAblityMonthlyFor(deptScore.getValue().get(i).getIndexCode(),
+ deptScore.getValue().get(i).getScore(),
+ monthlyFormDTO);
+ }
+ }
+ // 查询网格的 上级组织id 和 组织名称
+ ScreenCustomerDeptEntity parentDeptInfo = screenCustomerDeptDao.selectParentDeptInfo(customerId, deptScore.getKey());
+ if (null == parentDeptInfo){
+ throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey());
+ }
+ // 补充表中其他字段
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, deptScore.getKey(),
+ parentDeptInfo.getParentAgencyId(), parentDeptInfo.getDeptName(), monthlyFormDTO);
+ monthlyFormDTOList.add(monthlyFormDTO);
+ }
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+
+ /**
+ * 将区/街道相关分数表 数据 插入月表 screenIndexDataMonthlyDao
+ *
+ * @param month 08
+ * @param year 2020
+ * @param customerId 客户id
+ * @param agencyScoreDTOS 区/街道相关分数表 当前客户所属月份数据集
+ * @return void
+ * @Author zhangyong
+ * @Date 14:17 2020-09-03
+ **/
+ private void insertIndexDataMonthlyByAgencyScore(String month, String year, String customerId, List agencyScoreDTOS){
+ List monthlyFormDTOList = new ArrayList<>();
+ // 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据
+ Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId));
+ String[] orgIds = new String[collect.size()];
+ int j = 0;
+ for(Map.Entry> agencyScore : collect.entrySet()){
+ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
+ // 组织id(eg:社区或者街道id)
+ orgIds[j] = agencyScore.getKey();
+ j++;
+ for ( int i = 0; i < agencyScore.getValue().size(); i++){
+ if (NumConstant.ONE_STR.equals(agencyScore.getValue().get(i).getIsTotal())){
+ // 是总分 总指数 = IS_TOTAL = 1
+ monthlyFormDTO.setIndexTotal(agencyScore.getValue().get(i).getScore());
+ } else {
+ // 赋值 党建能力、治理能力、服务能力
+ monthlyFormDTO = this.setValueAblityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(),
+ agencyScore.getValue().get(i).getScore(),
+ monthlyFormDTO);
+ }
+ }
+ // 当前组织 的上级组织id
+ String parentAgencyId = agencyScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
+ // 查询 组织名称
+ String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, agencyScore.getKey());
+ if (null == agencyName){
+ throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey());
+ }
+ // 补充表中其他字段
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, agencyScore.getKey(),
+ parentAgencyId, agencyName, monthlyFormDTO);
+ monthlyFormDTOList.add(monthlyFormDTO);
+ }
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+
+ /**
+ * 指数-指数数据(每月数值) 表 字段补全,待新增
+ * @param year 2020
+ * @param month 08
+ * @param orgType 组织类别 agency:组织;部门:department;网格:grid
+ * @param orgId 组织Id 可以为网格,机关id
+ * @param parentId 上级组织id
+ * @param orgName 组织名称
+ * @param monthlyFormDTO 待新增的DTO
+ * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
+ * @Author zhangyong
+ * @Date 15:29 2020-09-03
+ **/
+ private IndexDataMonthlyFormDTO supplementIndexDataMonthlyTable(String year, String month, String orgType, String orgId, String parentId,
+ String orgName, IndexDataMonthlyFormDTO monthlyFormDTO){
+ monthlyFormDTO.setYearId(year);
+ monthlyFormDTO.setMonthId(year + month);
+ monthlyFormDTO.setOrgType(orgType);
+ monthlyFormDTO.setOrgId(orgId);
+ // 根据网格id,查询其上级组织id、组织名称
+ monthlyFormDTO.setParentId(parentId);
+ monthlyFormDTO.setOrgName(orgName);
+ return monthlyFormDTO;
+ }
+
+ /**
+ * 赋值 党建能力、治理能力、服务能力
+ * (总指数 赋默认值)
+ * @param IndexCode 组织类别
+ * @param Score 分数
+ * @param monthlyFormDTO 待保存的数据
+ * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
+ * @Author zhangyong
+ * @Date 09:26 2020-09-04
+ **/
+ private IndexDataMonthlyFormDTO setValueAblityMonthlyFor(String IndexCode, BigDecimal Score,
+ IndexDataMonthlyFormDTO monthlyFormDTO){
+ // 赋默认值
+ if (null == monthlyFormDTO.getIndexTotal() && null == monthlyFormDTO.getPartyDevAblity()
+ && null == monthlyFormDTO.getGovernAblity() && null == monthlyFormDTO.getServiceAblity()){
+ BigDecimal zero = new BigDecimal(NumConstant.ZERO);
+ monthlyFormDTO.setIndexTotal(zero);
+ monthlyFormDTO.setPartyDevAblity(zero);
+ monthlyFormDTO.setGovernAblity(zero);
+ monthlyFormDTO.setServiceAblity(zero);
+ }
+ // 赋实际值
+ if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){
+ // 党建能力
+ monthlyFormDTO.setPartyDevAblity(Score);
+ } else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){
+ // 治理能力
+ monthlyFormDTO.setGovernAblity(Score);
+ } else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){
+ // 服务能力
+ monthlyFormDTO.setServiceAblity(Score);
+ }
+ return monthlyFormDTO;
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
index cd0c93b654..b472801ad9 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
@@ -43,6 +43,25 @@
AND data_type = #{dataType}
+
+
-
\ No newline at end of file
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
index a5a7972279..a528c94f95 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
@@ -3,4 +3,22 @@
-
\ No newline at end of file
+
+
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml
index c3da270827..07e3b05b94 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml
@@ -84,4 +84,22 @@
GROUP BY fics.agency_id
-
\ No newline at end of file
+
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml
index 9d2176f678..b6eed400a2 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml
@@ -24,4 +24,23 @@
AND figc.index_code = #{indexCode}
GROUP BY figc.agency_id
-
\ 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 4d16660ed3..dda779d7b9 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
@@ -60,4 +60,14 @@
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
index d014071995..8937212e71 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
@@ -64,4 +64,15 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.DEPT_ID =#{deptId}
+
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 fdb4f2407c..7a8c216fea 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
@@ -105,4 +105,16 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.GRID_ID = #{gridId}
+
+