diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
index b1bfe5d08e..8e065c792a 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
@@ -40,6 +40,7 @@ public class CustomerApplicationRunner implements ApplicationRunner {
public void run(ApplicationArguments args) {
//发送启动成功消息
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
+ logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode())) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml
index 847c53fbd2..42687e7517 100644
--- a/epmet-gateway/pom.xml
+++ b/epmet-gateway/pom.xml
@@ -182,7 +182,7 @@
lb://data-statistical-server
-
+
lb://epmet-openapi-scan
diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml
index ad6ed50dc2..8fdb335fda 100644
--- a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml
+++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
data-report-server:
container_name: data-report-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:0.3.27
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:0.3.36
ports:
- "8108:8108"
network_mode: host # 使用现有网络
diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml
index 9a3f62f01c..78d38da205 100644
--- a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml
+++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
data-report-server:
container_name: data-report-server-test
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.27
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.36
ports:
- "8108:8108"
network_mode: host # 使用现有网络
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 4d26f40f48..d5be2db6e9 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
@@ -54,6 +54,16 @@ public class FactIndexGridScoreDTO implements Serializable {
*/
private String gridId;
+ /**
+ * 所有上级ID,用英文逗号分开
+ */
+ private String allParentIds;
+
+ /**
+ * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
+ */
+ private String quarterId;
+
/**
* 月维度Id: yyyyMM
*/
diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
index cda119284c..159fec681b 100644
--- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
@@ -15,4 +15,4 @@ services:
resources:
limits:
cpus: '0.1'
- memory: 300M
+ memory: 300M
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml
index 029e37c343..b62847d615 100644
--- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml
+++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
data-statistical-server:
container_name: data-statistical-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-statistical-server:0.3.42
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-statistical-server:0.3.48
ports:
- "8108:8108"
network_mode: host # 使用现有网络
diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml
index 2e5a7af0e8..075a43a0af 100644
--- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml
+++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
data-statistical-server:
container_name: data-statistical-server-test
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.42
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.47
ports:
- "8108:8108"
network_mode: host # 使用现有网络
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
index 95919792d9..7c88be956c 100644
--- 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
@@ -9,7 +9,7 @@
package com.epmet.constant;
/**
- * 组织类别 常量
+ * 组织类别/机关级别 常量
*
* @author sun
* @since 1.0.0
@@ -30,4 +30,20 @@ public interface OrgTypeConstant {
* 组织
*/
String AGENCY = "agency";
+
+ /**
+ * 乡(镇、街道)级
+ */
+ String STREET = "street";
+
+ /**
+ * 区县级
+ */
+ String DISTRICT = "district";
+
+ /**
+ * 社区级
+ */
+ String COMMUNITY = "community";
+
}
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 397d99df7a..bf2e750a65 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
@@ -1,8 +1,10 @@
package com.epmet.controller;
+import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.GridScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
@@ -167,7 +169,7 @@ public class DemoController {
// deptScoreService.calculateDeptCorreLation(formDTO);
return new Result();
}
-
+ @DataSource(DataSourceConstant.EVALUATION_INDEX)
@PostMapping("insertgridinfo")
public Result insertScreenCustomerGrid(){
ScreenCustomerGridEntity entity1=new ScreenCustomerGridEntity();
@@ -205,6 +207,7 @@ public class DemoController {
return new Result();
}
+ @DataSource(DataSourceConstant.EVALUATION_INDEX)
@PostMapping("inserttestdata")
public Result test(){
//网格相关-党建能力
@@ -253,7 +256,7 @@ public class DemoController {
entity1.setPartyAvgShiftProjectCount(50); //网格党员人均提出的议题转项目数
entity1.setUserAvgShiftProjectCount(50); //网格群众人均提出的议题转项目数
entity1.setCreateGroupPartyCount(35); //建群党员数(累计值) 去重
- entity1.setPublishArticleCount(35); //网格发文数
+ entity1.setPublishArticleCount(50); //网格发文数
entity1.setIssueToProjectRatio(new BigDecimal("50")); //网格议题转项目率
entity1.setCreateThreeMeetsCount(10); //组织三会一课次数
entity1.setJoinThreeMeetsCount(30); //党员参加三会一课人次
@@ -284,7 +287,7 @@ public class DemoController {
entity2.setCreateGroupPartyCount(30); //建群党员数(累计值) 去重
entity2.setPublishArticleCount(30); //网格发文数
entity2.setIssueToProjectRatio(new BigDecimal("30")); //网格议题转项目率
- entity2.setCreateThreeMeetsCount(25); //组织三会一课次数
+ entity2.setCreateThreeMeetsCount(35); //组织三会一课次数
entity2.setJoinThreeMeetsCount(20); //党员参加三会一课人次
entity2.setCreatedBy(IndexCalConstant.insertUser);
@@ -462,4 +465,22 @@ public class DemoController {
String monthId = "202008";
indexCalculateDistrictService.calDistrictAll(customerId,monthId);
}
+ @PostMapping("gridZxc")
+ public void getGrid(){
+ String customerId = "b09527201c4409e19d1dbc5e3c3429a1";
+ String monthId = "202008";
+ CalculateCommonFormDTO c = new CalculateCommonFormDTO();
+ c.setCustomerId(customerId);
+ c.setMonthId(monthId);
+ gridCorreLationService.calculateGridCorreLation(c);
+ }
+ @PostMapping("deptZxc")
+ public void getDept(){
+ String customerId = "b09527201c4409e19d1dbc5e3c3429a1";
+ String monthId = "202008";
+ CalculateCommonFormDTO c = new CalculateCommonFormDTO();
+ c.setCustomerId(customerId);
+ c.setMonthId(monthId);
+ deptScoreService.calculateDeptCorreLation(c);
+ }
}
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 b30d2751d1..5cbcfb20e2 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
@@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO;
import com.epmet.entity.evaluationindex.indexcal.AgencyScoreEntity;
+import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -69,7 +70,7 @@ public interface AgencyScoreDao extends BaseDao {
* @author zxc
* @date 2020/8/31 1:51 下午
*/
- List selectAgencyScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
+ List selectAgencyScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType);
/**
@@ -81,4 +82,25 @@ public interface AgencyScoreDao extends BaseDao {
* @Date 10:43 2020-09-03
**/
List selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
+ /**
+ * 批量插入区/街道相关分数表
+ *
+ * @param list
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 11:11 2020-09-04
+ **/
+ void batchInsertAgencyScoreData(@Param("list") List list, @Param("customerId")String customerId);
+
+ /**
+ * 根据入参查询 区/街道相关分数表id
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListAgencyId(@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 b77849a5d5..4be461b59a 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,8 @@
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
-import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO;
+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;
@@ -45,6 +45,27 @@ public interface DeptScoreDao extends BaseDao {
**/
List selectListDeptScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+ /**
+ * 批量插入 区直部门分值表
+ *
+ * @param list
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 11:11 2020-09-04
+ **/
+ void batchInsertDeptScoreData(@Param("list") List list, @Param("customerId")String customerId);
+
+ /**
+ * 根据入参查询 区直部门分值表id
+ * @param customerId
+ * @param monthId
+ * @return java.lang.String
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListDeptId(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
/**
* @Description 所有直属部门治理能力平均值
@@ -56,4 +77,14 @@ public interface DeptScoreDao extends BaseDao {
*/
List selectGovernDeptScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
+ /**
+ * @return int
+ * @param customerId
+ * @param monthId
+ * @param deptId
+ * @author yinzuomei
+ * @description
+ * @Date 2020/9/7 14:30
+ **/
+ int deleteByDeptIdAndMonthId(@Param("customerId") String customerId, @Param("monthId")String monthId,@Param("deptId") String deptId);
}
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 a6060a2bf7..40fd49e6ab 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
@@ -18,8 +18,6 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
-import com.epmet.dto.indexcal.SubCommunityGovernAvgResultDTO;
-import com.epmet.dto.indexcal.SubCommunityPartyAvgResultDTO;
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity;
@@ -82,4 +80,24 @@ public interface FactIndexCommunityScoreDao extends BaseDao selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
+ /**
+ * 批量插入 社区相关分数表
+ *
+ * @param list
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 11:11 2020-09-04
+ **/
+ void batchInsertCommunityScoreData(@Param("list") List list, @Param("customerId")String customerId);
+
+ /**
+ * 根据入参查询 查询社区id
+ * @param customerId
+ * @param monthId
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListCommunityId(@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/FactIndexGridScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java
index 8a8a1f8a38..77c3f85366 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
@@ -19,9 +19,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;
import com.epmet.entity.evaluationindex.screen.FactIndexGridScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -47,30 +45,33 @@ public interface FactIndexGridScoreDao extends BaseDao
List selectSubGridAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/**
- * @Description 社区下属所有网格治理能力汇总平均值
+ * 根据入参查询 网格相关分值记录
* @param customerId
* @param monthId
- * @author zxc
- * @date 2020/8/31 9:19 上午
- */
- List selectSubGridGovernAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListGridScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
- * @Description 社区下级所有网格服务能力得分平均值
+ * 根据入参查询 网格id
* @param customerId
* @param monthId
- * @author zxc
- * @date 2020/8/31 1:51 下午
- */
- List selectSubGridServiceAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:43 2020-09-03
+ **/
+ List selectListGridId(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
- * 根据入参查询 网格相关分值记录
+ * 批量插入 网格相关分值表
+ *
+ * @param list
* @param customerId
- * @param monthId
- * @return java.util.List
+ * @return void
* @Author zhangyong
- * @Date 10:43 2020-09-03
+ * @Date 11:11 2020-09-04
**/
- List selectListGridScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
+ void batchInsertGridScoreData(@Param("list") List list,@Param("customerId")String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java
index b22d6a4a71..17e7a7eb82 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java
@@ -34,6 +34,4 @@ import java.util.List;
public interface IndexGroupDetailDao extends BaseDao {
List getDetailListByParentCode(@Param("customerId") String customerId, @Param("indexCode") String indexCode);
-
- List getDetailListLikeParentCode(@Param("customerId") String customerId, @Param("parentIndexCode") String parentIndexCode);
}
\ No newline at end of file
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 20147e0f82..4912171860 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
@@ -57,13 +57,22 @@ public interface ScreenCustomerAgencyDao extends BaseDao list, @Param("customerId")String customerId);
/**
- * 根据客户id、组织id,查询区/街道 组织名称
+ * 返回当前客户下,未匹配到的组织信息
+ * @param customerId 客户id
+ * @param agencyIds 组织id集合
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 14:38 2020-09-04
+ **/
+ List selectListMismatcAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds);
+
+ /**
+ * 根据客户id,查询区/街道 组织名称、id
*
* @param customerId 客户id
- * @param agencyId 组织id
- * @return java.util.String
+ * @return java.util.List
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
- String selectParentAgencyInfo(@Param("customerId")String customerId, @Param("agencyId")String agencyId);
+ List selectListAgencyInfo(@Param("customerId")String customerId);
}
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 7cfb17110c..53a5fcf042 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
@@ -22,7 +22,6 @@ import com.epmet.dto.screencoll.form.CustomerDeptFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
-import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@@ -58,16 +57,6 @@ 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
@@ -77,4 +66,25 @@ public interface ScreenCustomerDeptDao extends BaseDao
* @Date 2020/9/3 16:32
**/
ScreenCustomerDeptEntity selectParentAgencyId(@Param("customerId") String customerId, @Param("deptId") String deptId);
+
+ /**
+ * 返回当前客户下,未匹配到的区直部门信息
+ *
+ * @param customerId
+ * @param deptIds
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:45 2020-09-04
+ **/
+ List selectListMismatchDeptInfo(@Param("customerId") String customerId,
+ @Param("deptIds") String[] deptIds);
+
+ /**
+ * 根据客户id 查询部门 信息
+ * @param customerId 客户id
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 16:57 2020-09-03
+ **/
+ List selectListDeptInfo(@Param("customerId")String customerId);
}
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 0d9a6420f9..005f69289b 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
@@ -96,12 +96,23 @@ public interface ScreenCustomerGridDao extends BaseDao
ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId);
/**
- * 根据客户id、网格id,查询网格(党支部)父级信息
+ * 返回当前客户下,未匹配到的网格信息
+ *
+ * @param customerId
+ * @param gridIds
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 10:45 2020-09-04
+ **/
+ List selectListMismatchGridInfo(@Param("customerId") String customerId,
+ @Param("gridIds") String[] gridIds);
+
+ /**
+ * 根据客户id 查询网格(党支部)详细信息
* @param customerId
- * @param gridId
- * @return com.epmet.dto.screen.FactIndexGridScoreDTO
+ * @return java.util.List
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
- ScreenCustomerGridDTO selectParentGridInfo(@Param("customerId")String customerId, @Param("gridId")String gridId);
+ List selectListGridInfo(@Param("customerId")String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
index a38ff1cbe6..4ebfc825e4 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
@@ -60,4 +60,16 @@ public interface ScreenIndexDataMonthlyDao extends BaseDao list, @Param("customerId")String customerId);
+
+ /**
+ * 获取今年的各月份的平均值
+ * @param customerId
+ * @param yearId
+ * @param month 做除法运算
+ * @return java.util.List
+ * @Author zhangyong
+ * @Date 15:51 2020-09-04
+ **/
+ List selectListIndexDataMonthlyByYear(@Param("customerId") String customerId,
+ @Param("yearId") String yearId, @Param("month") String month);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java
index cc29f12a95..a49d1a1e13 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java
@@ -24,7 +24,7 @@ public enum IndexCodeEnum {
DANG_WU_HUO_DONG("dangwuhuodong", "党务活动", 4),
LIAN_XI_QUN_ZHONG("lianxiqunzhong", "联系群众", 4),
ZUZHINEIDANGYDLXQZNLKPFPJZ("zuzhineidangydlxqznlkpfpjz","组织内党员的联系群众能力考评分(平均值)",5),
- ZUZHINEIDANGYDSYYSNLKPFPJZ("zuzhineidangydsyysnlkpfpjz","组织内党员的参与议事能力考评分(平均值)",5),
+ ZUZHINEIDANGYDSYYSNLKPFPJZ("zuzhineidangydcyysnlkpfpjz","组织内党员的参与议事能力考评分(平均值)",5),
XIA_SHU_SUO_YOU_WGDDJNLPJZ("xiashusuoyouwgddjnlpjz","下属所有网格的党建能力(平均值)",5),
SHE_QU_XIA_SHU_SYWGZLNLHZPJZ("shequxiashusywgzlnlhzpjz","社区下属所有网格治理能力汇总(平均值)",5),
SHE_QU_XIA_JI_SYWGFWNLDFPJZ("shequxiajisywgfwnldfpjz","社区下级所有网格服务能力得分(平均值) ",5),
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
index 52ea21e80a..959f3caa64 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
@@ -152,7 +152,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl {
if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) {
//对应的数值
- String sampleValueStr = (String) recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key));
+ String sampleValueStr =String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key)));
//构造样本值对象
SampleValue currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.DEPT_ID), new BigDecimal(sampleValueStr));
indexInputVO.getIndexValueVOs().add(currentGridIndexValue);
@@ -194,6 +194,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl>> publishArticleList = ListUtils.partition(publishArticleCountList, IndexCalConstant.PAGE_SIZE);
publishArticleList.forEach( publish -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
publish.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
@@ -166,6 +166,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
detailListByParentCode.forEach(detail -> {
if (IndexCodeEnum.SHE_QU_XIA_SHU_SYWGZLNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List subGridGovernAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+ if (CollectionUtils.isEmpty(subGridGovernAvg)){
+ log.error("社区下级治理能力平均分集合为空");
+ return;
+ }
if (subGridGovernAvg.size() == NumConstant.ONE) {
pid.put(subGridGovernAvg.get(NumConstant.ZERO).getAgencyId(),subGridGovernAvg.get(NumConstant.ZERO).getParentId());
sizeOne(subGridGovernAvg.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),pid);
@@ -205,7 +209,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
List>> governAbilityList = ListUtils.partition(communityGovernAbility, IndexCalConstant.PAGE_SIZE);
governAbilityList.forEach(governAbility -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
governAbility.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
@@ -254,7 +258,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE);
serviceAvgList.forEach(serviceAvg -> {
- BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
serviceAvg.forEach(c -> {
pid.put(c.getAgencyId(),c.getParentId());
@@ -284,7 +288,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
List>> communityActivityList = ListUtils.partition(communityActivityCountList, IndexCalConstant.PAGE_SIZE);
communityActivityList.forEach(communityActivity -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
communityActivity.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
index 4fd50137bd..9baa63df36 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
@@ -9,7 +9,6 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao;
-import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao;
import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO;
@@ -104,7 +103,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
//党建能力平均值
indexDetailList.forEach(detail -> {
if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
- List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
+ List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
return;
@@ -147,7 +146,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
List>> publishArticleList = ListUtils.partition(publishArticleCountList, IndexCalConstant.PAGE_SIZE);
publishArticleList.forEach( publish -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
publish.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
@@ -184,7 +183,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
Map pid = new HashMap<>();
detailListByParentCode.forEach(detail -> {
if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) {
- List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+ List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (districtGovernAvgList.size() == NumConstant.ONE) {
pid.put(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(),districtGovernAvgList.get(NumConstant.ZERO).getParentId());
sizeOne(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),pid);
@@ -254,7 +253,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
detailListByParentCode.forEach(detail -> {
String indexCode = detail.getIndexCode();
if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) {
- List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode());
+ List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (subStreetAvgList.size() == NumConstant.ONE) {
pid.put(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(),subStreetAvgList.get(NumConstant.ZERO).getParentId());
sizeOne(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),pid);
@@ -263,7 +262,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE);
serviceAvgList.forEach(serviceAvg -> {
- BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
serviceAvg.forEach(c -> {
pid.put(c.getAgencyId(),c.getParentId());
@@ -312,6 +311,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
score.setMonthId(monthId);
score.setYearId(DateUtils.getYearId(monthId));
score.setQuarterId(DateUtils.getQuarterId(monthId));
+ score.setDataType(IndexCalConstant.DISTRICT_LEVEL);
score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
value.forEach(community -> {
score.setScore(score.getScore().add(community.getScore()));
@@ -351,7 +351,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
public void deleteAndInsert(String customerId, String monthId, String indexCode, List subAllDistrict) {
if (!CollectionUtils.isEmpty(subAllDistrict)) {
agencyScoreDao.deleteOldRecord(customerId, monthId, indexCode,IndexCalConstant.DISTRICT_LEVEL);
- System.err.println(subAllDistrict.size());
agencyScoreDao.insertStreetRecord(subAllDistrict);
}
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
index f305df99e2..9385c1f121 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
@@ -9,10 +9,7 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.IndexCalculateForm;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCodeFieldReRedis;
-import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService;
-import com.epmet.service.evaluationindex.indexcal.GridCorreLationService;
-import com.epmet.service.evaluationindex.indexcal.IndexCalculateCommunityService;
-import com.epmet.service.evaluationindex.indexcal.IndexCalculateService;
+import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -41,6 +38,12 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private IndexCodeFieldReRedis indexCodeFieldReRedis;
@Autowired
private IndexCalculateCommunityService indexCalculateCommunityService;
+ @Autowired
+ private IndexCalculateStreetService indexCalculateStreetService;
+ @Autowired
+ private IndexCalculateDistrictService indexCalculateDistrictService;
+ @Autowired
+ private DeptScoreService deptScoreService;
@Override
public Boolean indexCalculate(IndexCalculateForm formDTO) {
@@ -87,6 +90,33 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
log.error("indexCalculate calAll exception", e);
break;
}
+
+ //计算街道
+ try {
+ indexCalculateStreetService.calStreetAll(customerId,formDTO.getMonthId());
+ log.info("indexCalculate calAll return result:{}", flag);
+ } catch (Exception e) {
+ log.error("indexCalculate calAll exception", e);
+ break;
+ }
+
+ //计算区直属
+ try {
+ deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO);
+ log.info("indexCalculate calAll return result:{}", flag);
+ } catch (Exception e) {
+ log.error("indexCalculate calAll exception", e);
+ break;
+ }
+
+ //计算全区
+ try {
+ indexCalculateDistrictService.calDistrictAll(customerId,formDTO.getMonthId());
+ log.info("indexCalculate calAll return result:{}", flag);
+ } catch (Exception e) {
+ log.error("indexCalculate calAll exception", e);
+ break;
+ }
}
return flag;
} catch (Exception e) {
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
index 473b7c7ccb..e18de69bb2 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
@@ -152,7 +152,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(mapList.stream().map(m -> new BigDecimal(m.get(fieldName).toString())).collect(Collectors.toList()));
List>> publishArticleList = ListUtils.partition(mapList, IndexCalConstant.PAGE_SIZE);
publishArticleList.forEach(publish -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
publish.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
@@ -221,8 +221,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
return;
} else if (communityGovernAbility.size() > NumConstant.ONE) {
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
- System.err.println(fieldNameByIndexCode);
- System.err.println(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode()));
return;
@@ -231,7 +229,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
List>> governAbilityList = ListUtils.partition(communityGovernAbility, IndexCalConstant.PAGE_SIZE);
governAbilityList.forEach(governAbility -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
+ System.err.println(detail.getCorrelation());
List index1SampleValues = new ArrayList<>();
governAbility.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
@@ -278,7 +277,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE);
serviceAvgList.forEach(serviceAvg -> {
- BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
serviceAvg.forEach(c -> {
pid.put(c.getAgencyId(),c.getParentId());
@@ -308,7 +307,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
List>> communityActivityList = ListUtils.partition(communityActivityCountList, IndexCalConstant.PAGE_SIZE);
communityActivityList.forEach(communityActivity -> {
- ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
+ ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
List index1SampleValues = new ArrayList<>();
communityActivity.forEach(c -> {
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString());
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 715bc56b0f..2d6a2c48ed 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
@@ -1,7 +1,10 @@
package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
+import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
@@ -15,10 +18,17 @@ 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.dto.screencoll.form.IndexDataYearlyFormDTO;
+import com.epmet.entity.evaluationindex.indexcal.AgencyScoreEntity;
+import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
+import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity;
+import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +48,7 @@ import java.util.stream.Collectors;
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class FactIndexCollectServiceImpl implements FactIndexCollectService {
+ private static final Logger log = LoggerFactory.getLogger(FactIndexCollectServiceImpl.class);
@Autowired
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao;
@@ -207,51 +218,71 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
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);
+ // 开始处理 网格相关分值表
+ this.startHandleIndexGridScore(monthId, customerId);
+ // 开始处理 社区相关分值表
+ this.startHandleIndexCommunityScore(monthId, customerId);
+ // 开始处理 区直部门分值表
+ this.startHandleIndexDeptScore(monthId, customerId);
+ // 开始处理 区/街道相关分数表
+ this.startHandleIndexAgencyScore(monthId, customerId);
- // 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);
- }
+ // 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly
+ this.insertIndexDataYear(monthId, customerId);
+ }
- // fact_index_agency_score 区/街道相关分数表 agency
- List agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId);
- if (null != agencyScoreDTOS && agencyScoreDTOS.size() > NumConstant.ZERO) {
- this.insertIndexDataMonthlyByAgencyScore(month, year, customerId, agencyScoreDTOS);
+ /**
+ * 目标:将网格的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表)
+ * 如果网格相关分值表 中的网格数量不全,需要从 网格(党支部)信息表 中,先查询到缺少的网格信息,赋上默认值后,在插入网格相关分值表。 一对四
+ *
+ * @param monthId
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 13:44 2020-09-04
+ **/
+ private void startHandleIndexGridScore(String monthId, String customerId){
+ // 查询网格相关分值记录 表已经存在的网格id
+ List indexGridIds = factIndexGridScoreDao.selectListGridId(customerId, monthId);
+ if (indexGridIds.size() > NumConstant.ZERO){
+ // 根据网格相关分值表 中查询到的网格id,去 网格(党支部)信息表 进行不匹配查询。
+ String[] gridIds = new String[indexGridIds.size()];
+ for (int i = NumConstant.ZERO; i < indexGridIds.size(); i++){
+ gridIds[i] = indexGridIds.get(i);
+ }
+ // 进行不匹配查询(即返回网格相关分值表 中不存在的网格信息)。
+ List mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds);
+ // 将 网格相关分值表 中,本月份没有的网格信息,按照 4种类型,各新增一遍,赋默认值 0
+ if (mismatchGridList.size() > NumConstant.ZERO){
+ this.insertIndexGridScoreDefaultValue(monthId, customerId, mismatchGridList);
+ }
+ } else {
+ // 将所有的网格按照 4种类型,各赋一遍默认值
+ List mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null);
+ this.insertIndexGridScoreDefaultValue(monthId, customerId, mismatchGridList);
}
-
- // 插入年表 screen_index_data_yearly
+ // 开始处理实际分数
+ // fact_index_grid_score 网格相关分值记录表 grid
+ List gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId);
+ this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS);
}
/**
* 将网格相关分值记录表 数据 插入月表 screenIndexDataMonthlyDao
*
- * @param month 08
- * @param year 2020
+ * @param monthId 202008
* @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){
+ private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List gridScoreDTOS){
List monthlyFormDTOList = new ArrayList<>();
// 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId));
+ // 查询网格的 上级组织id 和 组织名称
+ List parentGridList = screenCustomerGridDao.selectListGridInfo(customerId);
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry> gridScore : collect.entrySet()){
@@ -259,6 +290,8 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 网格id
orgIds[j] = gridScore.getKey();
j++;
+ // 给4个指数 赋默认值
+ monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
for ( int i = 0; i < gridScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){
// 是总分
@@ -267,41 +300,88 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore());
}
} else {
- // 赋值 党建能力、治理能力、服务能力
- monthlyFormDTO = this.setValueAblityMonthlyFor(gridScore.getValue().get(i).getIndexCode(),
+ // 赋实际值 党建能力、治理能力、服务能力
+ monthlyFormDTO = this.setValueAbilityMonthlyFor(gridScore.getValue().get(i).getIndexCode(),
gridScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
}
- // 查询网格的 上级组织id 和 组织名称
- ScreenCustomerGridDTO parentGridInfo = screenCustomerGridDao.selectParentGridInfo(customerId, gridScore.getKey());
- if (null == parentGridInfo){
+ // 匹配网格的 上级组织id 和 组织名称
+ String parentAgencyId = "";
+ String gridName = "";
+ for (ScreenCustomerGridDTO gridDTO : parentGridList){
+ if (gridScore.getKey().equals(gridDTO.getGridId())){
+ parentAgencyId = gridDTO.getParentAgencyId();
+ gridName = gridDTO.getGridName();
+ }
+ }
+ if ("".equals(parentAgencyId)){
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);
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScore.getKey(),
+ parentAgencyId, gridName, monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
- screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
- screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ if (monthlyFormDTOList.size() > NumConstant.ZERO){
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, getYearStr(monthId), monthId, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+ }
+
+ /**
+ * 目标:将社区的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表)
+ * 如果社区相关分值表 中的社区数量不全,需要从 组织机构信息 中,先查询到缺少的社区信息,赋上默认值后,在插入社区相关分值表。 一对四
+ *
+ * @param monthId
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 13:44 2020-09-04
+ **/
+ private void startHandleIndexCommunityScore(String monthId, String customerId){
+ // 查询社区相关分值记录id
+ List indexCommunityIds = factIndexCommunityScoreDao.selectListCommunityId(customerId, monthId);
+ if (indexCommunityIds.size() > NumConstant.ZERO){
+ // 根据社区相关分值表 中查询到的社区id,去 组织机构信息 进行不匹配查询。
+ String[] communityIds = new String[indexCommunityIds.size()];
+ for (int i = NumConstant.ZERO; i < indexCommunityIds.size(); i++){
+ communityIds[i] = indexCommunityIds.get(i);
+ }
+ // 进行不匹配查询(即返回社区相关分值表 中不存在的社区信息)。
+ List mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, communityIds);
+ // 将 社区相关分数表 中,本月份没有的社区信息,按照 4种类型,各新增一遍,赋默认值 0
+ if (mismatchAgencyList.size() > NumConstant.ZERO){
+ this.insertIndexCommunityScoreDefaultValue(monthId, customerId, mismatchAgencyList);
+ }
+ } else {
+ // 将所有的社区按照 4种类型,各赋一遍默认值
+ List mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null);
+ this.insertIndexCommunityScoreDefaultValue(monthId, customerId, mismatchAgencyList);
+ }
+ // 开始处理实际分数
+ // fact_index_community_score 社区相关分数表 agency
+ // 查询社区相关分值记录
+ List communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId);
+ this.insertIndexDataMonthlyByCommunityScore(monthId, customerId, communityScoreDTOS);
}
/**
* 社区相关分数表 数据 插入月表 screenIndexDataMonthlyDao
*
- * @param month 08
- * @param year 2020
+ * @param monthId 202008
* @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){
+ private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List communityScoreDTOS){
List monthlyFormDTOList = new ArrayList<>();
// 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
+ // 根据客户id,查询区/街道 组织名称、id
+ List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry> communityScore : collect.entrySet()){
@@ -309,6 +389,8 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 组织id
orgIds[j] = communityScore.getKey();
j++;
+ // 给4个指数 赋默认值
+ monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
for ( int i = 0; i < communityScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){
// 是总分
@@ -318,7 +400,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
} else {
// 赋值 党建能力、治理能力、服务能力
- monthlyFormDTO = this.setValueAblityMonthlyFor(communityScore.getValue().get(i).getIndexCode(),
+ monthlyFormDTO = this.setValueAbilityMonthlyFor(communityScore.getValue().get(i).getIndexCode(),
communityScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
@@ -326,36 +408,76 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 当前组织 的上级组织id
String parentAgencyId = communityScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
- // 查询 组织名称
- String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, communityScore.getKey());
- if (null == agencyName){
+ // 获取 组织名称
+ String agencyName = "";
+ for (ScreenCustomerAgencyEntity agencyScoreDTO : parentAgencyList) {
+ if (communityScore.getKey().equals(agencyScoreDTO.getAgencyId())) {
+ agencyName = agencyScoreDTO.getAgencyName();
+ }
+ }
+ if ("".equals(agencyName)){
throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey());
}
// 补充表中其他字段
- monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, communityScore.getKey(),
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
// 补充表中其他字段
monthlyFormDTOList.add(monthlyFormDTO);
}
- screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
- screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ if (monthlyFormDTOList.size() > NumConstant.ZERO){
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, getYearStr(monthId), monthId, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+ }
+
+ /**
+ * 目标:将区直部门的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表)
+ * 如果 区直部门分值表 中的部门数量不全,需要从 部门信息表 中,先查询到缺少的部门信息,赋上默认值后,在插入 区直部门分值表。 一对四
+ *
+ * @param monthId
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 13:44 2020-09-04
+ **/
+ private void startHandleIndexDeptScore(String monthId, String customerId){
+ // 查询社 区直部门分值表
+ List indexDeptIds = deptScoreDao.selectListDeptId(customerId, monthId);
+ if (indexDeptIds.size() > NumConstant.ZERO){
+ String[] depeIds = new String[indexDeptIds.size()];
+ for (int i = NumConstant.ZERO; i < indexDeptIds.size(); i++){
+ depeIds[i] = indexDeptIds.get(i);
+ }
+ List mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds);
+ if (mismatchDeptList.size() > NumConstant.ZERO){
+ this.insertIndexDeptScoreDefaultValueFor(monthId, customerId, mismatchDeptList);
+ }
+ } else {
+ List mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null);
+ this.insertIndexDeptScoreDefaultValueFor(monthId, customerId, mismatchDeptList);
+ }
+ // 开始处理实际分数
+ // fact_index_dept_score 区直部门分值表 department
+ // 查询社 区直部门分值表
+ List deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId);
+ this.insertIndexDataMonthlyByDeptScore(monthId, customerId, deptScoreDTOS);
}
/**
* 将区直部门分值表 数据 插入月表 screenIndexDataMonthlyDao
*
- * @param month 08
- * @param year 2020
+ * @param monthId 202008
* @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){
+ private void insertIndexDataMonthlyByDeptScore(String monthId, String customerId, List deptScoreDTOS){
List monthlyFormDTOList = new ArrayList<>();
// 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据
Map> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId));
+ List parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId);
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry> deptScore : collect.entrySet()){
@@ -363,46 +485,85 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 部门id
orgIds[j] = deptScore.getKey();
j++;
+ // 给4个指数 赋默认值
+ monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
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);
- }
+ // 区直街道的总分 就是 治理能力
+ monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore());
+ // 赋值 治理能力
+ monthlyFormDTO = this.setValueAbilityMonthlyFor(deptScore.getValue().get(i).getIndexCode(),
+ deptScore.getValue().get(i).getScore(),
+ monthlyFormDTO);
}
// 查询网格的 上级组织id 和 组织名称
- ScreenCustomerDeptEntity parentDeptInfo = screenCustomerDeptDao.selectParentDeptInfo(customerId, deptScore.getKey());
- if (null == parentDeptInfo){
+ String parentAgencyId = "";
+ String deptName = "";
+ for (ScreenCustomerDeptEntity deptEntity : parentDeptList) {
+ if (deptScore.getKey().equals(deptEntity.getDeptId())) {
+ parentAgencyId = deptEntity.getParentAgencyId();
+ deptName = deptEntity.getDeptName();
+ }
+ }
+ if ("".equals(parentAgencyId)){
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);
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScore.getKey(),
+ parentAgencyId, deptName, monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
- screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
- screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ if (monthlyFormDTOList.size() > NumConstant.ZERO){
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, getYearStr(monthId), monthId, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
+ }
+
+ /**
+ * 目标:将 区/街道的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表)
+ * 如果 区/街道相关分数表 中的组织数量不全,需要从 组织机构信息 中,先查询到缺少的组织信息,赋上默认值后,在插入 区/街道相关分数表。 一对四
+ *
+ * @param monthId
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 13:44 2020-09-04
+ **/
+ private void startHandleIndexAgencyScore(String monthId, String customerId){
+ List indexAgencyIds = agencyScoreDaol.selectListAgencyId(customerId, monthId);
+ if (indexAgencyIds.size() > NumConstant.ZERO){
+ String[] agencyIds = new String[indexAgencyIds.size()];
+ for (int i = NumConstant.ZERO; i < indexAgencyIds.size(); i++){
+ agencyIds[i] = indexAgencyIds.get(i);
+ }
+ List mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, agencyIds);
+ if (mismatchAgencyList.size() > NumConstant.ZERO){
+ this.insertIndexAgencyScoreDefaultValueFor(monthId, customerId, mismatchAgencyList);
+ }
+ } else {
+ List mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null);
+ this.insertIndexAgencyScoreDefaultValueFor(monthId, customerId, mismatchAgencyList);
+ }
+ // 开始处理实际分数
+ // fact_index_agency_score 区/街道相关分数表 agency
+ List agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId);
+ this.insertIndexDataMonthlyByAgencyScore(monthId, customerId, agencyScoreDTOS);
}
/**
* 将区/街道相关分数表 数据 插入月表 screenIndexDataMonthlyDao
*
- * @param month 08
- * @param year 2020
+ * @param monthId 202008
* @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){
+ private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List agencyScoreDTOS){
List monthlyFormDTOList = new ArrayList<>();
// 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId));
+ List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry> agencyScore : collect.entrySet()){
@@ -410,13 +571,15 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 组织id(eg:社区或者街道id)
orgIds[j] = agencyScore.getKey();
j++;
+ // 给4个指数 赋默认值
+ monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
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(),
+ monthlyFormDTO = this.setValueAbilityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(),
agencyScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
@@ -424,23 +587,29 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 当前组织 的上级组织id
String parentAgencyId = agencyScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
// 查询 组织名称
- String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, agencyScore.getKey());
- if (null == agencyName){
+ String agencyName = "";
+ for (ScreenCustomerAgencyEntity agencyScoreDTO : parentAgencyList) {
+ if (agencyScore.getKey().equals(agencyScoreDTO.getAgencyId())) {
+ agencyName = agencyScoreDTO.getAgencyName();
+ }
+ }
+ if ("".equals(agencyName)){
throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey());
}
// 补充表中其他字段
- monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, agencyScore.getKey(),
+ monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, agencyScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
- screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
- screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ if (monthlyFormDTOList.size() > NumConstant.ZERO){
+ screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, getYearStr(monthId), monthId, orgIds);
+ screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
+ }
}
/**
* 指数-指数数据(每月数值) 表 字段补全,待新增
- * @param year 2020
- * @param month 08
+ * @param monthId 202008
* @param orgType 组织类别 agency:组织;部门:department;网格:grid
* @param orgId 组织Id 可以为网格,机关id
* @param parentId 上级组织id
@@ -450,10 +619,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 15:29 2020-09-03
**/
- private IndexDataMonthlyFormDTO supplementIndexDataMonthlyTable(String year, String month, String orgType, String orgId, String parentId,
+ private IndexDataMonthlyFormDTO supplementIndexDataMonthlyTable(String monthId, String orgType, String orgId, String parentId,
String orgName, IndexDataMonthlyFormDTO monthlyFormDTO){
- monthlyFormDTO.setYearId(year);
- monthlyFormDTO.setMonthId(year + month);
+ monthlyFormDTO.setYearId(getYearStr(monthId));
+ monthlyFormDTO.setMonthId(monthId);
monthlyFormDTO.setOrgType(orgType);
monthlyFormDTO.setOrgId(orgId);
// 根据网格id,查询其上级组织id、组织名称
@@ -463,8 +632,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
/**
- * 赋值 党建能力、治理能力、服务能力
- * (总指数 赋默认值)
+ * 赋实际值 党建能力、治理能力、服务能力
* @param IndexCode 组织类别
* @param Score 分数
* @param monthlyFormDTO 待保存的数据
@@ -472,17 +640,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @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);
- }
+ private IndexDataMonthlyFormDTO setValueAbilityMonthlyFor(String IndexCode, BigDecimal Score, IndexDataMonthlyFormDTO monthlyFormDTO){
// 赋实际值
if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){
// 党建能力
@@ -496,4 +654,257 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
return monthlyFormDTO;
}
+
+ /**
+ * 设置 指数-指数数据(月、年) 表
+ * 总指数、党建能力指数、治理能力、服务能力 默认值 0
+ * @param monthlyFormDTO
+ * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
+ * @Author zhangyong
+ * @Date 11:01 2020-09-04
+ **/
+ private IndexDataMonthlyFormDTO setIndexDefaultValueFor(IndexDataMonthlyFormDTO monthlyFormDTO){
+ BigDecimal zero = new BigDecimal(NumConstant.ZERO);
+ monthlyFormDTO.setIndexTotal(zero);
+ monthlyFormDTO.setPartyDevAblity(zero);
+ monthlyFormDTO.setGovernAblity(zero);
+ monthlyFormDTO.setServiceAblity(zero);
+ return monthlyFormDTO;
+ }
+
+ /**
+ * 新增 网格相关分值记录表 默认值,一条网格,按照组织类别的不同 需要插入4次
+ *
+ * @param monthId 例:202008
+ * @param customerId
+ * @param mismatchGridList 网格相关分值记录表 中缺少的网格集合
+ * @return void
+ * @Author zhangyong
+ * @Date 14:02 2020-09-04
+ **/
+ private void insertIndexGridScoreDefaultValue(String monthId, String customerId, List mismatchGridList){
+ List insertIndexGridScoreDTOS = new ArrayList<>();
+ BigDecimal zero = new BigDecimal(NumConstant.ZERO);
+ for (ScreenCustomerGridDTO gridDTO : mismatchGridList){
+ FactIndexGridScoreDTO indexGridScoreDTO = new FactIndexGridScoreDTO();
+ // 赋默认值 - 党建能力指数
+ indexGridScoreDTO.setGridId(gridDTO.getGridId());
+ indexGridScoreDTO.setAgencyId(gridDTO.getParentAgencyId());
+ indexGridScoreDTO.setAllParentIds(gridDTO.getAllParentIds());
+ //季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
+ indexGridScoreDTO.setQuarterId(DateUtils.getQuarterId(monthId));
+ indexGridScoreDTO.setYearId(getYearStr(monthId));
+ indexGridScoreDTO.setMonthId(monthId);
+ // 0 or 1
+ indexGridScoreDTO.setIsTotal(NumConstant.ZERO_STR);
+ indexGridScoreDTO.setScore(zero);
+ indexGridScoreDTO.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
+ indexGridScoreDTO.setDelFlag(NumConstant.ZERO_STR);
+ insertIndexGridScoreDTOS.add(indexGridScoreDTO);
+
+ FactIndexGridScoreDTO indexGridScoreDTO1 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
+ // 赋默认值 - 治理能力
+ indexGridScoreDTO1.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+ insertIndexGridScoreDTOS.add(indexGridScoreDTO1);
+
+ FactIndexGridScoreDTO indexGridScoreDTO2 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
+ // 赋默认值 - 服务能力
+ indexGridScoreDTO2.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
+ insertIndexGridScoreDTOS.add(indexGridScoreDTO2);
+
+ FactIndexGridScoreDTO indexGridScoreDTO3 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
+ indexGridScoreDTO3.setIsTotal(NumConstant.ONE_STR);
+ // 赋默认值 - 网格相关
+ indexGridScoreDTO3.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
+ insertIndexGridScoreDTOS.add(indexGridScoreDTO3);
+ }
+ factIndexGridScoreDao.batchInsertGridScoreData(insertIndexGridScoreDTOS, customerId);
+ }
+
+ /**
+ * 新增 社区相关分数表 默认值,一条组织id,按照组织类别的不同 需要插入4次
+ *
+ * @param monthId
+ * @param customerId
+ * @param mismatchAgencyList
+ * @return void
+ * @Author zhangyong
+ * @Date 14:02 2020-09-04
+ **/
+ private void insertIndexCommunityScoreDefaultValue(String monthId, String customerId, List mismatchAgencyList){
+ List insertIndexCommunityScore = new ArrayList<>();
+ BigDecimal zero = new BigDecimal(NumConstant.ZERO);
+ for (ScreenCustomerAgencyEntity agencyDTO : mismatchAgencyList){
+ FactIndexCommunityScoreEntity communityScore1 = new FactIndexCommunityScoreEntity();
+ // 赋默认值 - 党建能力指数
+ communityScore1.setAgencyId(agencyDTO.getAgencyId());
+ communityScore1.setParentAgencyId(agencyDTO.getPid());
+ //季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
+ communityScore1.setQuarterId(DateUtils.getQuarterId(monthId));
+ communityScore1.setYearId(getYearStr(monthId));
+ communityScore1.setMonthId(monthId);
+ // 0 or 1
+ communityScore1.setIsTotal(NumConstant.ZERO_STR);
+ communityScore1.setScore(zero);
+ communityScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
+ insertIndexCommunityScore.add(communityScore1);
+
+ // 赋默认值 - 治理能力
+ FactIndexCommunityScoreEntity communityScore2 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
+ communityScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+ insertIndexCommunityScore.add(communityScore2);
+
+ // 赋默认值 - 服务能力
+ FactIndexCommunityScoreEntity communityScore3 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
+ communityScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
+ insertIndexCommunityScore.add(communityScore3);
+
+ // 赋默认值 - 社区相关
+ FactIndexCommunityScoreEntity communityScore4 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
+ communityScore4.setIsTotal(NumConstant.ONE_STR);
+ communityScore4.setIndexCode(IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
+ insertIndexCommunityScore.add(communityScore4);
+ }
+ factIndexCommunityScoreDao.batchInsertCommunityScoreData(insertIndexCommunityScore, customerId);
+ }
+
+ /**
+ * 新增 区直部门分值表 默认值,一条部门id,按照组织类别的不同 需要插入1次
+ *
+ * @param monthId
+ * @param customerId
+ * @param mismatchDeptList
+ * @return void
+ * @Author zhangyong
+ * @Date 14:02 2020-09-04
+ **/
+ private void insertIndexDeptScoreDefaultValueFor(String monthId, String customerId, List mismatchDeptList){
+ List insertIndexDeptScore = new ArrayList<>();
+ for (ScreenCustomerDeptEntity deptDTO : mismatchDeptList){
+ DeptScoreEntity deptScore2 = new DeptScoreEntity();
+ // 赋默认值 - 治理能力
+ deptScore2.setDeptId(deptDTO.getDeptId());
+ deptScore2.setAgencyId(deptDTO.getParentAgencyId());
+ //季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
+ deptScore2.setQuarterId(DateUtils.getQuarterId(monthId));
+ deptScore2.setYearId(getYearStr(monthId));
+ deptScore2.setMonthId(monthId);
+ deptScore2.setIsTotal(NumConstant.ZERO_STR);
+ deptScore2.setScore(new BigDecimal(NumConstant.ZERO));
+ deptScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+ deptScore2.setDelFlag(NumConstant.ZERO_STR);
+ insertIndexDeptScore.add(deptScore2);
+ }
+ deptScoreDao.batchInsertDeptScoreData(insertIndexDeptScore, customerId);
+ }
+
+ /**
+ * 新增 区/街道相关分数表 默认值,一条组织id,按照组织类别的不同 需要插入4次
+ *
+ * @param monthId
+ * @param customerId
+ * @param mismatchAgencyList
+ * @return void
+ * @Author zhangyong
+ * @Date 14:02 2020-09-04
+ **/
+ private void insertIndexAgencyScoreDefaultValueFor(String monthId, String customerId, List mismatchAgencyList){
+ BigDecimal zero = new BigDecimal(NumConstant.ZERO);
+ List insertIndexAgencyScore = new ArrayList<>();
+ for (ScreenCustomerAgencyEntity agencyDTO : mismatchAgencyList){
+ if (OrgTypeConstant.COMMUNITY.equals(agencyDTO.getLevel()) || OrgTypeConstant.STREET.equals(agencyDTO.getLevel())
+ || OrgTypeConstant.DISTRICT.equals(agencyDTO.getLevel())){
+ AgencyScoreEntity agencyScore1 = new AgencyScoreEntity();
+ // 赋默认值 - 党建能力指数
+ agencyScore1.setAgencyId(agencyDTO.getAgencyId());
+ agencyScore1.setParentAgencyId(agencyDTO.getPid());
+ //季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
+ agencyScore1.setQuarterId(DateUtils.getQuarterId(monthId));
+ agencyScore1.setYearId(getYearStr(monthId));
+ agencyScore1.setMonthId(monthId);
+ // 0 or 1
+ agencyScore1.setIsTotal(NumConstant.ZERO_STR);
+ agencyScore1.setScore(zero);
+ agencyScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
+
+ AgencyScoreEntity agencyScore2 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
+ // 赋默认值 - 治理能力
+ agencyScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
+
+ AgencyScoreEntity agencyScore3 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
+ // 赋默认值 - 服务能力
+ agencyScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
+
+ AgencyScoreEntity agencyScore4 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
+ agencyScore4.setIsTotal(NumConstant.ONE_STR);
+ if (OrgTypeConstant.COMMUNITY.equals(agencyDTO.getLevel())){
+ // 赋默认值 - 全区相关
+ agencyScore4.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
+ agencyScore4.setDataType(OrgTypeConstant.DISTRICT);
+ agencyScore1.setDataType(OrgTypeConstant.DISTRICT);
+ agencyScore2.setDataType(OrgTypeConstant.DISTRICT);
+ agencyScore3.setDataType(OrgTypeConstant.DISTRICT);
+ } else if (OrgTypeConstant.STREET.equals(agencyDTO.getLevel()) || OrgTypeConstant.DISTRICT.equals(agencyDTO.getLevel())){
+ // 赋默认值 - 街道相关
+ agencyScore4.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode());
+ agencyScore4.setDataType(OrgTypeConstant.STREET);
+ agencyScore1.setDataType(OrgTypeConstant.STREET);
+ agencyScore2.setDataType(OrgTypeConstant.STREET);
+ agencyScore3.setDataType(OrgTypeConstant.STREET);
+ }
+ insertIndexAgencyScore.add(agencyScore1);
+ insertIndexAgencyScore.add(agencyScore2);
+ insertIndexAgencyScore.add(agencyScore3);
+ insertIndexAgencyScore.add(agencyScore4);
+ }
+ }
+ agencyScoreDaol.batchInsertAgencyScoreData(insertIndexAgencyScore, customerId);
+ }
+
+ /**
+ * 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly
+ *
+ * @param monthId
+ * @param customerId
+ * @return void
+ * @Author zhangyong
+ * @Date 22:06 2020-09-04
+ **/
+ private void insertIndexDataYear(String monthId, String customerId){
+ List monthlyFormList = screenIndexDataMonthlyDao.selectListIndexDataMonthlyByYear(customerId, getYearStr(monthId), getMonthStr(monthId));
+ String[] orgIds = new String[monthlyFormList.size()];
+ for (int i = NumConstant.ZERO; i < monthlyFormList.size(); i++){
+ orgIds[i] = monthlyFormList.get(i).getOrgId();
+ }
+ if (monthlyFormList.size() > NumConstant.ZERO){
+ screenIndexDataYearlyDao.deleteIndexDataYearly(customerId, getYearStr(monthId), orgIds);
+ List entity = ConvertUtils.sourceToTarget(monthlyFormList, IndexDataYearlyFormDTO.class);
+ screenIndexDataYearlyDao.batchInsertIndexDataYearly(entity, customerId);
+ }
+ }
+
+ /**
+ * 将月份id,拆分成 年份
+ *
+ * @param monthId 202008
+ * @return java.lang.String
+ * @Author zhangyong
+ * @Date 13:39 2020-09-04
+ **/
+ private String getYearStr(String monthId){
+ return monthId.substring(NumConstant.ZERO, NumConstant.FOUR);
+ }
+
+
+ /**
+ * 将月份id,拆分成 月份
+ *
+ * @param monthId 202008
+ * @return java.lang.String
+ * @Author zhangyong
+ * @Date 13:39 2020-09-04
+ **/
+ private String getMonthStr(String monthId){
+ return monthId.substring(NumConstant.FOUR, NumConstant.SIX);
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java
index 7c5d083ff7..f202beca1b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java
@@ -35,12 +35,4 @@ public interface IndexGroupDetailService extends BaseService getDetailListByParentCode(String customerId,String... indexCode);
-
- /**
- * desc:获取所有 包含该指标code的
- * @param customerId
- * @param parentIndexCode
- * @return
- */
- List getDetailListLikeParentCode(String customerId, String parentIndexCode);
}
\ 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/IndexGroupDetailServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java
index 8a81ca0af0..7a8935bd02 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java
@@ -51,9 +51,4 @@ public class IndexGroupDetailServiceImpl extends BaseServiceImpl getDetailListLikeParentCode(String customerId, String parentIndexCode) {
- return baseDao.getDetailListLikeParentCode(customerId,parentIndexCode);
- }
}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java
index b3a9ac1760..8d392a2c21 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java
@@ -29,7 +29,8 @@ public class Pinyin4jUtil {
duoyinMap.put('期',new String[]{"qi"});
duoyinMap.put('参',new String[]{"can"});
duoyinMap.put('均',new String[]{"jun"});
- duoyinMap.put('会',new String[]{"hui"});
+ duoyinMap.put('会', new String[]{"hui"});
+ duoyinMap.put('属', new String[]{"shu"});
}
/**
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 179fd5c9eb..211e573c3c 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
@@ -100,6 +100,66 @@
AND fics.customer_id = #{customerId}
AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode}
+ AND fics.DATA_TYPE = #{dataType}
GROUP BY fics.agency_id
+
+
+ insert into fact_index_agency_score
+ (
+ ID,
+ CUSTOMER_ID,
+
+ AGENCY_ID,
+ PARENT_AGENCY_ID,
+ YEAR_ID,
+ QUARTER_ID,
+ MONTH_ID,
+ DATA_TYPE,
+ IS_TOTAL,
+ SCORE,
+ INDEX_CODE,
+
+ DEL_FLAG,
+ REVISION,
+ CREATED_BY,
+ CREATED_TIME,
+ UPDATED_BY,
+ UPDATED_TIME
+ ) values
+
+ (
+ (SELECT REPLACE(UUID(), '-', '') AS id),
+ #{customerId},
+ #{item.agencyId},
+ #{item.parentAgencyId},
+
+ #{item.yearId},
+ #{item.quarterId},
+ #{item.monthId},
+ #{item.dataType},
+ #{item.isTotal},
+ #{item.score},
+ #{item.indexCode},
+ 0,
+ 0,
+ 'APP_USER',
+ now(),
+ 'APP_USER',
+ now()
+ )
+
+
+
+
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 8e01fb1e52..077c6a7430 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
@@ -43,4 +43,65 @@
GROUP BY fidc.agency_id
+
+ insert into fact_index_dept_score
+ (
+ ID,
+ CUSTOMER_ID,
+ DEPT_ID,
+ AGENCY_ID,
+ QUARTER_ID,
+ YEAR_ID,
+ MONTH_ID,
+ IS_TOTAL,
+ SCORE,
+ INDEX_CODE,
+
+ DEL_FLAG,
+ REVISION,
+ CREATED_BY,
+ CREATED_TIME,
+ UPDATED_BY,
+ UPDATED_TIME
+ ) values
+
+ (
+ (SELECT REPLACE(UUID(), '-', '') AS id),
+ #{customerId},
+ #{item.deptId},
+ #{item.agencyId},
+ #{item.quarterId},
+ #{item.yearId},
+
+ #{item.monthId},
+ #{item.isTotal},
+ #{item.score},
+ #{item.indexCode},
+ #{item.delFlag},
+ 0,
+ 'APP_USER',
+ now(),
+ 'APP_USER',
+ now()
+ )
+
+
+
+
+
+
+ delete from fact_index_dept_score where CUSTOMER_ID = #{customerId}
+ AND MONTH_ID = #{monthId}
+ and DEPT_ID=#{deptId}
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml
index 3039ac9eed..67165f1bf7 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml
@@ -101,7 +101,7 @@
MAX(m.TRANSFERED_COUNT) as TRANSFERED_COUNT_MAX,
MIN(m.CLOSED_PROJECT_COUNT) as CLOSED_PROJECT_COUNT_MIN,
MAX(m.CLOSED_PROJECT_COUNT) as CLOSED_PROJECT_COUNT_MAX,
- MIN(m.RESP_PROJECT_RATIO) as RESP_PROJECT_RATIO_MIN_MAX,
+ MIN(m.RESP_PROJECT_RATIO) as RESP_PROJECT_RATIO_MIN,
MAX(m.RESP_PROJECT_RATIO) as RESP_PROJECT_RATIO_MAX,
MIN(m.HANDLE_PROJECT_RATIO) as HANDLE_PROJECT_RATIO_MIN,
MAX(m.HANDLE_PROJECT_RATIO) as HANDLE_PROJECT_RATIO_MAX,
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 07e3b05b94..7978db5eee 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
@@ -102,4 +102,59 @@
AND MONTH_ID = #{monthId}
ORDER BY AGENCY_ID
+
+
+
+
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 b6eed400a2..010ac06798 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
@@ -43,4 +43,61 @@
AND MONTH_ID = #{monthId}
ORDER BY GRID_ID
+
+
+ insert into fact_index_grid_score
+ (
+ ID,
+ CUSTOMER_ID,
+ GRID_ID,
+ AGENCY_ID,
+ ALL_PARENT_IDS,
+ QUARTER_ID,
+ YEAR_ID,
+ MONTH_ID,
+ IS_TOTAL,
+ SCORE,
+ INDEX_CODE,
+ DEL_FLAG,
+ REVISION,
+ CREATED_BY,
+ CREATED_TIME,
+ UPDATED_BY,
+ UPDATED_TIME
+ ) values
+
+ (
+ (SELECT REPLACE(UUID(), '-', '') AS id),
+ #{customerId},
+ #{item.gridId},
+ #{item.agencyId},
+ #{item.allParentIds},
+ #{item.quarterId},
+
+ #{item.yearId},
+ #{item.monthId},
+ #{item.isTotal},
+ #{item.score},
+ #{item.indexCode},
+ #{item.delFlag},
+ 0,
+ 'APP_USER',
+ now(),
+ 'APP_USER',
+ now()
+ )
+
+
+
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml
index 143cdacec1..c2ab3e07c6 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml
@@ -6,19 +6,10 @@
-
-
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml
index df9ec89823..a8e5f55a2e 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailTemplateDao.xml
@@ -7,7 +7,7 @@
delete from index_group_detail_template
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 dda779d7b9..36ac049262 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,14 +60,34 @@
-
-
+
+
+ SELECT
+ DEPT_ID deptId,
+ DEPT_NAME deptName,
+ PARENT_AGENCY_ID parentAgencyId
+ FROM
+ screen_customer_dept
+ WHERE
+ DEL_FLAG = '0'
+ AND CUSTOMER_ID =#{customerId}
+
+ AND DEPT_ID NOT IN
+
+ #{item}
+
+
+
+
+
SELECT
+ DEPT_ID deptId,
PARENT_AGENCY_ID parentAgencyId,
DEPT_NAME deptName
FROM
@@ -73,6 +93,5 @@
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
- AND 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 7a8c216fea..c85dc0af60 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
@@ -106,8 +106,28 @@
AND m.GRID_ID = #{gridId}
-
+
SELECT
+ GRID_ID gridId,
+ GRID_NAME gridName,
+ PARENT_AGENCY_ID parentAgencyId,
+ ALL_PARENT_IDS allParentIds
+ FROM
+ screen_customer_grid
+ WHERE
+ DEL_FLAG = '0'
+ AND CUSTOMER_ID =#{customerId}
+
+ AND GRID_ID NOT IN
+
+ #{item}
+
+
+
+
+
+ SELECT
+ GRID_ID gridId,
GRID_NAME gridName,
PARENT_AGENCY_ID parentAgencyId
FROM
@@ -115,6 +135,5 @@
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
- AND GRID_ID = #{gridId}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml
index 616d567b8a..4c8369dd0a 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml
@@ -59,4 +59,23 @@
+
+ SELECT
+ YEAR_ID yearId,
+ MONTH_ID monthId,
+ ORG_TYPE orgType,
+ ORG_ID orgId,
+ PARENT_ID parentId,
+ ORG_NAME orgName,
+ SUM(INDEX_TOTAL) / #{month} as indexTotal,
+ SUM(PARTY_DEV_ABLITY) / #{month} as partyDevAblity,
+ SUM(SERVICE_ABLITY) / #{month} as serviceAblity,
+ SUM(GOVERN_ABLITY) / #{month} as governAblity
+ FROM screen_index_data_monthly
+ WHERE DEL_FLAG = '0'
+ AND YEAR_ID = #{yearId}
+ AND CUSTOMER_ID = #{customerId}
+ GROUP BY ORG_ID
+
+
diff --git a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml
index 5a11859c4a..709b384c7a 100644
--- a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml
+++ b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-ext-server:
container_name: epmet-ext-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:0.0.6
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:0.0.7
ports:
- "8113:8113"
network_mode: host # 使用现有网络
diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml
index e368b27eda..9b72f3c260 100644
--- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml
+++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-test
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.131
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.132
ports:
- "8110:8110"
network_mode: host # 使用现有网络
diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml
index e6fa7ad473..6942418f11 100644
--- a/epmet-module/epmet-third/epmet-third-server/pom.xml
+++ b/epmet-module/epmet-third/epmet-third-server/pom.xml
@@ -203,8 +203,8 @@
123456
true
- 122.152.200.70:8848
- fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b
+ 192.168.1.130:8848
+ 6ceab336-d004-4acf-89c6-e121d06f4988
false
diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml
index 0c08e7e115..e7aae13868 100644
--- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml
+++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
gov-project-server:
container_name: gov-project-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.40
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.43
ports:
- "8102:8102"
network_mode: host # 使用现有网络
diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java
index ee133cd136..d8a8641ddb 100644
--- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java
+++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java
@@ -5,6 +5,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
+import java.util.List;
/**
* 查询客户定制功能列表-接口入参
@@ -25,6 +26,11 @@ public class FunctionDetailFromDTO implements Serializable {
*/
@NotBlank(message = "客户Id不能为空", groups = {AddUserShowGroup.class})
private String customerId;
+ /**
+ * 网格ID
+ */
+ @NotBlank(message = "网格Id不能为空", groups = {AddUserShowGroup.class})
+ private String gridId;
/**
* resi:居民端,work:工作端
@@ -32,4 +38,19 @@ public class FunctionDetailFromDTO implements Serializable {
@NotBlank(message = "所属端不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class})
private String clientType;
+ /**
+ * token中userId
+ */
+ private String userId;
+
+ /**
+ * 所属端(居民端:resi 工作端:gov)
+ */
+ private String fromApp;
+
+ /**
+ * 用户角色key集合
+ */
+ private List roleKeyList;
+
}
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java
index 245d5018a2..76dff2a151 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java
@@ -18,6 +18,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
@@ -105,7 +106,9 @@ public class CustomerFunctionDetailController {
@PostMapping("resifunctiondetaillist")
public Result> resiFunctionDetail(@LoginUser TokenDto tokenDto, @RequestBody FunctionDetailFromDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, FunctionDetailFromDTO.AddUserShowGroup.class);
- return new Result>().ok(customerFunctionDetailService.resiAndWorkFunctionDetail(formDTO));
+ formDTO.setUserId(tokenDto.getUserId());
+ formDTO.setFromApp(AppClientConstant.APP_RESI);
+ return new Result>().ok(customerFunctionDetailService.resiFunctionDetail(formDTO));
}
/**
@@ -118,7 +121,9 @@ public class CustomerFunctionDetailController {
public Result> workFunctionDetail(@LoginUser TokenDto tokenDto, @RequestBody FunctionDetailFromDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, FunctionDetailFromDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
- return new Result>().ok(customerFunctionDetailService.resiAndWorkFunctionDetail(formDTO));
+ formDTO.setUserId(tokenDto.getUserId());
+ formDTO.setFromApp(AppClientConstant.APP_GOV);
+ return new Result>().ok(customerFunctionDetailService.workFunctionDetail(formDTO));
}
/**
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java
index 4a1eb94497..5a00d7e20a 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionRoleDao.java
@@ -20,6 +20,8 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerFunctionRoleDTO;
import com.epmet.dto.form.CustomerFunctionRoleListFormDTO;
+import com.epmet.dto.form.FunctionDetailFromDTO;
+import com.epmet.dto.form.SaveCustomerFunctionRoleFormDTO;
import com.epmet.dto.result.CustomerFunctionRoleListResultDTO;
import com.epmet.entity.CustomerFunctionRoleEntity;
import org.apache.ibatis.annotations.Mapper;
@@ -40,7 +42,7 @@ public interface CustomerFunctionRoleDao extends BaseDao selectCustomerFunctionRoleList(CustomerFunctionRoleListFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return
+ * @author sun
+ * @Description 根据用户拥有的角色查询客户的定制功能
+ */
+ List selectFunctionList(FunctionDetailFromDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java
index d0561093e3..7571294f23 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java
@@ -102,9 +102,17 @@ public interface CustomerFunctionDetailService extends BaseService resiAndWorkFunctionDetail(FunctionDetailFromDTO formDTO);
+ List resiFunctionDetail(FunctionDetailFromDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 工作端-根据所属端和客户Id查询客户定制功能列表
+ **/
+ List workFunctionDetail(FunctionDetailFromDTO formDTO);
/**
* 修改客户定制功能上下架
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java
index d57623db5d..895b1da73b 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java
@@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@@ -28,10 +29,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
-import com.epmet.dao.CustomerFunctionDao;
-import com.epmet.dao.CustomerFunctionDetailDao;
-import com.epmet.dao.FunctionCustomizedDao;
-import com.epmet.dao.FunctionShoppingHistoryDao;
+import com.epmet.dao.*;
import com.epmet.dto.CustomerFunctionDetailDTO;
import com.epmet.dto.FunctionCustomizedDTO;
import com.epmet.dto.FunctionShoppingHistoryDTO;
@@ -40,6 +38,7 @@ import com.epmet.dto.result.*;
import com.epmet.entity.CustomerFunctionDetailEntity;
import com.epmet.entity.CustomerFunctionEntity;
import com.epmet.entity.FunctionShoppingHistoryEntity;
+import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.CustomerFunctionDetailRedis;
import com.epmet.service.CustomerFunctionDetailService;
import com.epmet.service.FunctionShoppingHistoryService;
@@ -49,6 +48,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import rx.internal.util.LinkedArrayList;
import java.util.*;
import java.util.stream.Collectors;
@@ -73,6 +73,10 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl page(Map params) {
@@ -126,6 +130,58 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl resiFunctionDetail(FunctionDetailFromDTO formDTO) {
+ List restltList = new LinkedList<>();
+ //1.根据客户Id和所属端查询客户定制功能列表数据
+ logger.info(String.format("根据客户Id和所属端查询客户定制功能列表,对应客户Id->%s,所属端->%s", formDTO.getCustomerId(), formDTO.getClientType()));
+ List list = baseDao.selectFunctionDetailList(formDTO);
+ if (null != list && list.size() > NumConstant.ZERO) {
+ //1-1.设置自定义json数据(暂时为空)
+ try {
+ String join = String.join(",", new ArrayList<>());
+ String customerParameter = java.net.URLEncoder.encode(join, "utf-8");
+ list.forEach(l -> {
+ l.setCustomerParameter(customerParameter);
+ });
+ } catch (Exception e) {
+ logger.error("CustomerFunctionDetailServiceImpl.resiAndWorkFunctionDetail->集合参数URLEncode失败");
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
+ }
+
+ //2.调用user服务,获取用户角色信息
+ GetRoleKeyListFormDTO dto = new GetRoleKeyListFormDTO();
+ dto.setUserId(formDTO.getUserId());
+ dto.setGridId(formDTO.getGridId());
+ dto.setFromApp(AppClientConstant.APP_RESI);
+ Result> result = epmetUserOpenFeignClient.getUserRoleKeyList(dto);
+ if (!result.success()) {
+ throw new RenException(result.getCode());
+ }
+ formDTO.setRoleKeyList(result.getData());
+
+ //3.根据用户拥有的角色查询客户的定制功能
+ List listFunctionIds = customerFunctionRoleDao.selectFunctionList(formDTO);
+
+ //4.封装结果数据
+ listFunctionIds.forEach(id -> {
+ list.forEach(l -> {
+ if (id.equals(l.getFunctionId())) {
+ restltList.add(l);
+ }
+ });
+ });
+ }
+
+ return restltList;
+ }
+
/**
* @param formDTO
* @return
@@ -133,21 +189,48 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl resiAndWorkFunctionDetail(FunctionDetailFromDTO formDTO) {
- //根据客户Id和所属端查询客户定制功能列表数据
+ public List workFunctionDetail(FunctionDetailFromDTO formDTO) {
+ List restltList = new LinkedList<>();
+ //1.根据客户Id和所属端查询客户定制功能列表数据
logger.info(String.format("根据客户Id和所属端查询客户定制功能列表,对应客户Id->%s,所属端->%s", formDTO.getCustomerId(), formDTO.getClientType()));
List list = baseDao.selectFunctionDetailList(formDTO);
- try {
- String join = String.join(",", new ArrayList<>());
- String customerParameter = java.net.URLEncoder.encode(join, "utf-8");
- list.forEach(l->{
- l.setCustomerParameter(customerParameter);
+ if (null != list && list.size() > NumConstant.ZERO) {
+ //1-1.设置自定义json数据(暂时为空)
+ try {
+ String join = String.join(",", new ArrayList<>());
+ String customerParameter = java.net.URLEncoder.encode(join, "utf-8");
+ list.forEach(l->{
+ l.setCustomerParameter(customerParameter);
+ });
+ } catch (Exception e) {
+ logger.error("CustomerFunctionDetailServiceImpl.resiAndWorkFunctionDetail->集合参数URLEncode失败");
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
+ }
+
+ //2.调用user服务,获取用户角色信息
+ GetRoleKeyListFormDTO dto = new GetRoleKeyListFormDTO();
+ dto.setUserId(formDTO.getUserId());
+ dto.setFromApp(AppClientConstant.APP_GOV);
+ Result> result = epmetUserOpenFeignClient.getUserRoleKeyList(dto);
+ if (!result.success()) {
+ throw new RenException(result.getCode());
+ }
+ formDTO.setRoleKeyList(result.getData());
+
+ //3.根据用户拥有的角色查询客户的定制功能
+ List listFunctionIds = customerFunctionRoleDao.selectFunctionList(formDTO);
+
+ //4.封装结果数据
+ listFunctionIds.forEach(id -> {
+ list.forEach(l -> {
+ if (id.equals(l.getFunctionId())) {
+ restltList.add(l);
+ }
+ });
});
- } catch (Exception e) {
- logger.error("CustomerFunctionDetailServiceImpl.resiAndWorkFunctionDetail->集合参数URLEncode失败");
- throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
}
- return list;
+
+ return restltList;
}
@Override
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java
index 4ebfaa9f5f..f930ee6bdc 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionRoleServiceImpl.java
@@ -129,8 +129,8 @@ public class CustomerFunctionRoleServiceImpl extends BaseServiceImpl
+
+ SELECT
+ DISTINCT
+ FUNCTION_ID
+ FROM customer_function_role
+ WHERE del_flag = '0'
+ AND customer_id = #{customerId}
+ AND from_app = #{fromApp}
+
+ role_key = #{roleKey}
+
+
+
+
DELETE
FROM customer_function_role
WHERE customer_id = #{customerId}
+ AND function_id = #{functionId}
\ No newline at end of file
diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml
index e59f895806..3c154c7eec 100644
--- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml
+++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
resi-mine-server:
container_name: resi-mine-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:0.3.39
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:0.3.40
ports:
- "8094:8094"
network_mode: host # 使用现有网络
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetRoleKeyListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetRoleKeyListFormDTO.java
new file mode 100644
index 0000000000..263b263a8f
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetRoleKeyListFormDTO.java
@@ -0,0 +1,28 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description 获取用户拥有的角色key集合-接口入参
+ * @Author sun
+ */
+@Data
+public class GetRoleKeyListFormDTO implements Serializable{
+ private static final long serialVersionUID = -7994579456530273809L;
+
+ /**
+ * 用户Id
+ * */
+ private String userId;
+ /**
+ * 网格Id
+ * */
+ private String gridId;
+ /**
+ * 所属端(居民端:resi 工作端:gov)
+ * */
+ private String fromApp;
+}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
index 4e3da40627..939bbd7b80 100644
--- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
@@ -306,4 +306,11 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("epmetuser/staffrole/changeroleorg")
Result changeRoleOrg(@RequestBody StaffRoleDTO formDTO);
+
+ /**
+ * @Author sun
+ * @Description 居民端-查询用户角色key列表
+ **/
+ @PostMapping("epmetuser/role/getuserrolekeylist")
+ Result> getUserRoleKeyList(@RequestBody GetRoleKeyListFormDTO dto);
}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
index a60c9611ae..2a6db644e7 100644
--- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
@@ -205,4 +205,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result changeRoleOrg(StaffRoleDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "changeRoleOrg", formDTO);
}
+
+ @Override
+ public Result> getUserRoleKeyList(GetRoleKeyListFormDTO dto) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleKeyList", dto);
+ }
}
diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml
index 0f080c990f..183968322f 100644
--- a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml
+++ b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.122
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.124
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/RoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/RoleController.java
index e7c82100a6..98ec4c998f 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/RoleController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/RoleController.java
@@ -17,7 +17,9 @@
package com.epmet.controller;
+import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@@ -26,6 +28,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.RoleDTO;
+import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.excel.RoleExcel;
import com.epmet.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -91,4 +94,15 @@ public class RoleController {
ExcelUtils.exportExcelToTarget(response, null, list, RoleExcel.class);
}
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 居民端-查询用户角色key列表
+ **/
+ @PostMapping("getuserrolekeylist")
+ public Result> getUserRoleKeyList(@RequestBody GetRoleKeyListFormDTO formDTO) {
+ return new Result>().ok(roleService.getUserRoleKeyList(formDTO));
+ }
+
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
index dfc5407272..3124fc68c7 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
@@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
+import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
@@ -122,4 +123,12 @@ public interface StaffRoleDao extends BaseDao {
* @return void
*/
void updateStaffRoleOrgId(StaffRoleDTO dto);
+
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 工作端-查询用户角色key列表
+ **/
+ List selectStaffRoleKeyList(GetRoleKeyListFormDTO formDTO);
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
index e91e0c8d46..3801f0fcf4 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
@@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserRoleDTO;
+import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.entity.UserRoleEntity;
@@ -63,4 +64,12 @@ public interface UserRoleDao extends BaseDao {
* @Date 14:24 2020-07-23
**/
List getUserRoleInfoByUserId(@Param("userId") String userId);
+
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 居民端-查询用户角色key列表
+ **/
+ List selectUserRoleKeyList(GetRoleKeyListFormDTO formDTO);
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RoleService.java
index 72e055c4b1..21ac0465b0 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RoleService.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RoleService.java
@@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.RoleDTO;
+import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.entity.RoleEntity;
import java.util.List;
@@ -99,4 +100,12 @@ public interface RoleService extends BaseService {
* @return RoleDTO
*/
RoleDTO getRoleByKey(RoleDTO role);
+
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 居民端-查询用户角色key列表
+ **/
+ List getUserRoleKeyList(GetRoleKeyListFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RoleServiceImpl.java
index 8322ee7226..40b1e478ff 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RoleServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RoleServiceImpl.java
@@ -20,11 +20,15 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.AppClientConstant;
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.RoleDao;
+import com.epmet.dao.StaffRoleDao;
+import com.epmet.dao.UserRoleDao;
import com.epmet.dto.RoleDTO;
+import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.entity.RoleEntity;
import com.epmet.redis.RoleRedis;
import com.epmet.service.RoleService;
@@ -33,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -48,6 +53,10 @@ public class RoleServiceImpl extends BaseServiceImpl implem
@Autowired
private RoleRedis roleRedis;
+ @Autowired
+ private UserRoleDao userRoleDao;
+ @Autowired
+ private StaffRoleDao staffRoleDao;
@Override
public PageData page(Map params) {
@@ -106,4 +115,21 @@ public class RoleServiceImpl extends BaseServiceImpl implem
RoleEntity entity = baseDao.selectRoleByKey(ConvertUtils.sourceToTarget(role, RoleEntity.class));
return ConvertUtils.sourceToTarget(entity, RoleDTO.class);
}
+
+ /**
+ * @param formDTO
+ * @return
+ * @Author sun
+ * @Description 居民端-查询用户角色key列表
+ **/
+ @Override
+ public List getUserRoleKeyList(GetRoleKeyListFormDTO formDTO) {
+ List list = new ArrayList<>();
+ if(AppClientConstant.APP_RESI.equals(formDTO.getFromApp())){
+ list = userRoleDao.selectUserRoleKeyList(formDTO);
+ }else if(AppClientConstant.APP_GOV.equals(formDTO.getFromApp())){
+ list = staffRoleDao.selectStaffRoleKeyList(formDTO);
+ }
+ return list;
+ }
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml
index aabdfd6d71..0b39b350b7 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml
@@ -181,4 +181,16 @@
and sr.ROLE_ID = #{roleId}
and sr.DEL_FLAG='0'
+
+
+ SELECT
+ gsr.role_key
+ FROM
+ staff_role sr
+ INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id
+ WHERE
+ sr.del_flag = '0'
+ AND gsr.del_flag = '0'
+ AND sr.staff_id = #{userId}
+
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml
index 803fa40621..d7726d3b7b 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml
@@ -88,4 +88,16 @@
ur.USER_ID = #{userId}
+
+
+ SELECT
+ DISTINCT
+ er.role_key
+ FROM user_role ur
+ JOIN epmet_role er ON ur.role_id = er.id
+ WHERE er.del_flag = '0'
+ AND ur.del_flag = '0'
+ AND ur.user_id = #{userId}
+ AND ( ur.grid_id = #{gridId} OR ur.grid_id = 'all' )
+