diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml
index 1e797e0078..5f9e8ab342 100644
--- a/epmet-admin/epmet-admin-server/pom.xml
+++ b/epmet-admin/epmet-admin-server/pom.xml
@@ -141,6 +141,15 @@
true
192.168.1.140:9876;192.168.1.141:9876
epmet_message
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-admin
+ callerRunsPolicy
@@ -181,6 +190,15 @@
false
192.168.1.140:9876;192.168.1.141:9876
epmet_message
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-admin
+ callerRunsPolicy
@@ -217,6 +235,15 @@
true
192.168.10.161:9876
epmet_message
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-admin
+ callerRunsPolicy
@@ -254,6 +281,15 @@
true
192.168.11.187:9876;192.168.11.184:9876
epmet_message
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-admin
+ callerRunsPolicy
diff --git a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
index fc45940737..80503e260f 100644
--- a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
+++ b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
@@ -139,4 +139,15 @@ shutdown:
rocketmq:
enable: @rocketmq.enable@
- name-server: @rocketmq.nameserver@
\ No newline at end of file
+ name-server: @rocketmq.nameserver@
+
+thread:
+ # 线程池配置
+ threadPool:
+ enableCustomize: @thread.threadPool.enable-customize@
+ corePoolSize: @thread.threadPool.core-pool-size@
+ maxPoolSize: @thread.threadPool.max-pool-size@
+ queueCapacity: @thread.threadPool.queue-capacity@
+ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@
+ threadNamePrefix: @thread.threadPool.thread-name-prefix@
+ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@
\ No newline at end of file
diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml
index 35191104b2..0096ef714b 100644
--- a/epmet-auth/pom.xml
+++ b/epmet-auth/pom.xml
@@ -216,6 +216,15 @@
UUCnxLyXiB4eBF4p
https://epmet-cloud.elinkservice.cn
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-auth
+ callerRunsPolicy
@@ -273,6 +282,15 @@
UUCnxLyXiB4eBF4p
https://epmet-cloud.elinkservice.cn
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-auth
+ callerRunsPolicy
@@ -325,6 +343,15 @@
UUCnxLyXiB4eBF4p
https://epmet-cloud.elinkservice.cn
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-auth
+ callerRunsPolicy
@@ -382,6 +409,15 @@
UUCnxLyXiB4eBF4p
https://epmet-cloud.elinkservice.cn
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ epmet-auth
+ callerRunsPolicy
diff --git a/epmet-auth/src/main/resources/bootstrap.yml b/epmet-auth/src/main/resources/bootstrap.yml
index bf965caff7..8cdc2c21db 100644
--- a/epmet-auth/src/main/resources/bootstrap.yml
+++ b/epmet-auth/src/main/resources/bootstrap.yml
@@ -159,3 +159,15 @@ epmet:
# third服务的相关配置
third:
urlPrefix: @epmet.third.urlprefix@
+
+
+thread:
+ # 线程池配置
+ threadPool:
+ enableCustomize: @thread.threadPool.enable-customize@
+ corePoolSize: @thread.threadPool.core-pool-size@
+ maxPoolSize: @thread.threadPool.max-pool-size@
+ queueCapacity: @thread.threadPool.queue-capacity@
+ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@
+ threadNamePrefix: @thread.threadPool.thread-name-prefix@
+ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@
\ No newline at end of file
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java
new file mode 100644
index 0000000000..2778f3c9ef
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java
@@ -0,0 +1,93 @@
+package com.epmet.commons.tools.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * 线程池配置类
+ * thread:
+ * # 线程池配置
+ * threadPool:
+ * enableCustomize: true [true会使用自定义线程池,false则使用springboot自动配置的线程池。推荐使用自定义线程池]
+ * 可以只配置此参数,其他参会会使用默认值,但还是建议把参数配置全。
+ * corePoolSize: 2
+ * maxPoolSize: 4
+ * queueCapacity: 2
+ * keepAliveSeconds: 60
+ * threadNamePrefix: [线程池名字]
+ * rejectedExecutionHandler: [拒绝策略]
+ *
+ * 顺序:核心线程->放入队列->未达到maxPoolSize则继续增加线程直到达到maxPoolSize->拒绝策略
+ * 开启自定义线程池:thread.threadPool.enableCustomize=true,不配置或者配置为false,自定义线程池都不会开启
+ * rejectedExecutionHandler拒绝策略:abortPolicy/discardPolicy/discardOldestPolicy/callerRunsPolicy(默认)
+ */
+@EnableConfigurationProperties(EpmetThreadPoolProperties.class)
+@Configuration
+@ConditionalOnProperty(prefix = "thread.threadPool", name = "enableCustomize", havingValue = "true", matchIfMissing = false)
+public class AsyncConfig {
+
+ /**
+ * 默认值
+ */
+ private int corePoolSize = 5;
+ private int maxPoolSize = 8;
+ private int queueCapacity = 20;
+ private String threadNamePrefix = "epmet-default-";
+ private int keepAliveSeconds = 60;
+ private String rejectedExecutionHandler = "callerRunsPolicy";
+
+ public AsyncConfig(EpmetThreadPoolProperties properties) {
+ if (properties.getCorePoolSize() != null) corePoolSize = properties.getCorePoolSize();
+ if (properties.getMaxPoolSize() != null) maxPoolSize = properties.getMaxPoolSize();
+ if (properties.getQueueCapacity() != null) queueCapacity = properties.getQueueCapacity();
+ if (properties.getThreadNamePrefix() != null) threadNamePrefix = properties.getThreadNamePrefix();
+ if (properties.getKeepAliveSeconds() != null) keepAliveSeconds = properties.getKeepAliveSeconds();
+ if (properties.getRejectedExecutionHandler() != null) rejectedExecutionHandler = properties.getRejectedExecutionHandler();
+ }
+
+ @Bean
+ public Executor executor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix(threadNamePrefix);
+ executor.setRejectedExecutionHandler(getRejectedExecutionHandler(rejectedExecutionHandler)); //对拒绝task的处理策略
+ executor.setKeepAliveSeconds(keepAliveSeconds);
+ executor.initialize();
+ return executor;
+ }
+
+ @Bean
+ public ExecutorService executorService() {
+ ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) executor();
+ return executor.getThreadPoolExecutor();
+ }
+
+ /**
+ * 获取拒绝策略handler
+ * @param policy
+ * @return
+ */
+ private RejectedExecutionHandler getRejectedExecutionHandler(String policy) {
+ switch (policy) {
+ case "abortPolicy":
+ return new ThreadPoolExecutor.AbortPolicy();
+ case "discardPolicy":
+ return new ThreadPoolExecutor.DiscardPolicy();
+ case "discardOldestPolicy":
+ return new ThreadPoolExecutor.DiscardOldestPolicy();
+ default:
+ // 默认情况下,使用主线程执行
+ return new ThreadPoolExecutor.CallerRunsPolicy();
+ }
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/EpmetThreadPoolProperties.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/EpmetThreadPoolProperties.java
new file mode 100644
index 0000000000..1984a01dec
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/EpmetThreadPoolProperties.java
@@ -0,0 +1,47 @@
+package com.epmet.commons.tools.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * 线程池配置参数
+ * thread-pool会自动对应到threadPool
+ */
+@ConfigurationProperties(prefix = "thread.thread-pool")
+@Data
+public class EpmetThreadPoolProperties {
+
+ /**
+ * 是否允许自定义线程池
+ */
+ private Boolean enableCustomize;
+ /**
+ * 核心线程数
+ */
+ private Integer corePoolSize;
+
+ /**
+ * 最大线程数
+ */
+ private Integer maxPoolSize;
+
+ /**
+ * 队列容量
+ */
+ private Integer queueCapacity;
+
+ /**
+ * 线程名前缀
+ */
+ private String threadNamePrefix;
+
+ /**
+ * 线程存活时长
+ */
+ private Integer keepAliveSeconds;
+
+ /**
+ * 拒绝策略
+ */
+ private String rejectedExecutionHandler;
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
index 6cb7acc618..5a8173a414 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
@@ -259,6 +259,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-aggregator
+ callerRunsPolicy
@@ -375,6 +384,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-aggregator
+ callerRunsPolicy
@@ -491,6 +509,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-aggregator
+ callerRunsPolicy
@@ -608,6 +635,15 @@
https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c
SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-aggregator
+ callerRunsPolicy
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
index 934dcae2c5..9df581e38f 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
@@ -191,3 +191,14 @@ dingTalk:
logging:
level:
com.epmet.dataaggre: debug
+
+thread:
+ # 线程池配置
+ threadPool:
+ enableCustomize: @thread.threadPool.enable-customize@
+ corePoolSize: @thread.threadPool.core-pool-size@
+ maxPoolSize: @thread.threadPool.max-pool-size@
+ queueCapacity: @thread.threadPool.queue-capacity@
+ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@
+ threadNamePrefix: @thread.threadPool.thread-name-prefix@
+ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@
diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml
index cc8fb18e5a..bc3fe1b533 100644
--- a/epmet-module/data-report/data-report-server/pom.xml
+++ b/epmet-module/data-report/data-report-server/pom.xml
@@ -192,6 +192,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-report
+ callerRunsPolicy
@@ -246,6 +255,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-report
+ callerRunsPolicy
@@ -300,6 +318,15 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-report
+ callerRunsPolicy
@@ -354,6 +381,15 @@
https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c
SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
+
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-report
+ callerRunsPolicy
diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
index 2ee366e369..8f7e9c61c4 100644
--- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
@@ -158,3 +158,14 @@ shutdown:
graceful:
enable: true #是否开启优雅停机
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
+
+thread:
+ # 线程池配置
+ threadPool:
+ enableCustomize: @thread.threadPool.enable-customize@
+ corePoolSize: @thread.threadPool.core-pool-size@
+ maxPoolSize: @thread.threadPool.max-pool-size@
+ queueCapacity: @thread.threadPool.queue-capacity@
+ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@
+ threadNamePrefix: @thread.threadPool.thread-name-prefix@
+ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/UserGroupIdDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/UserGroupIdDTO.java
new file mode 100644
index 0000000000..854a000fde
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/UserGroupIdDTO.java
@@ -0,0 +1,13 @@
+package com.epmet.dto.extract;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class UserGroupIdDTO implements Serializable {
+ private String userId;
+ private List groupIdList;
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml
index 016afae6bd..37d097a236 100644
--- a/epmet-module/data-statistical/data-statistical-server/pom.xml
+++ b/epmet-module/data-statistical/data-statistical-server/pom.xml
@@ -286,11 +286,14 @@
false
-
- 5
- 8
- 10
- 30
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-statistical
+ callerRunsPolicy
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
@@ -415,11 +418,14 @@
false
-
- 5
- 8
- 10
- 30
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-statistical
+ callerRunsPolicy
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
@@ -543,11 +549,15 @@
false
-
- 5
- 8
- 10
- 30
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-statistical
+ callerRunsPolicy
+
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
@@ -667,11 +677,14 @@
false
-
- 5
- 8
- 10
- 30
+
+ true
+ 5
+ 8
+ 20
+ 60
+ data-statistical
+ callerRunsPolicy
https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java
deleted file mode 100644
index ba50e40a30..0000000000
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.epmet.config;
-
-import com.epmet.properties.ThreadProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ThreadPoolExecutor;
-
-/**
- * 线程池配置类
- */
-@Configuration
-@EnableConfigurationProperties(ThreadProperties.class)
-@EnableAsync
-public class AsyncConfig {
-
- @Autowired
- private ThreadProperties threadProperties;
-
- @Bean
- public Executor executor() {
- ThreadProperties.ThreadPoolProperties threadPoolProps = threadProperties.getThreadPool();
-
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(threadPoolProps.getCorePoolSize());
- executor.setMaxPoolSize(threadPoolProps.getMaxPoolSize());
- executor.setQueueCapacity(threadPoolProps.getQueueCapacity());
- executor.setThreadNamePrefix("data-stats-");
- // rejection-policy:当pool已经达到max size的时候,如何处理新任务
- // CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行
- executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //对拒绝task的处理策略
- executor.setKeepAliveSeconds(threadPoolProps.getKeepAlive());
- executor.initialize();
- return executor;
- }
-
- @Bean
- public ExecutorService executorService() {
- ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) executor();
- return executor.getThreadPoolExecutor();
- }
-
-}
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 a0abb1b2e2..84cb0c6964 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
@@ -54,7 +54,6 @@ import com.epmet.service.stats.DimAgencyService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import com.epmet.service.stats.DimCustomerService;
import com.epmet.util.DimIdGenerator;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -65,7 +64,9 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
-import java.util.concurrent.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
@RequestMapping("demo")
@RestController
@@ -620,20 +621,23 @@ public class DemoController {
private CalCpcIndexService calCpcIndexService;
@PostMapping("calCpcPartyAbility")
- public Result calCpcPartyAbility(@RequestParam("customerId") String customerId, @RequestParam("monthId")String monthId) {
+ public Result calCpcPartyAbility(@RequestParam("customerId") String customerId, @RequestParam("monthId") String monthId) {
+ long startCpc = System.currentTimeMillis();
if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(monthId)) {
- calCpcIndexService.calCpcPartyAbility(customerId,monthId);
- }else{
+ calCpcIndexService.calCpcPartyAbilityV2(customerId, monthId);
+ // calCpcIndexService.calCpcPartyAbility(customerId, monthId);
+ } else {
QueryWrapper customerEntityQueryWrapper = new QueryWrapper<>();
- List customerEntityList=dimCustomerDao.selectList(customerEntityQueryWrapper);
+ List customerEntityList = dimCustomerDao.selectList(customerEntityQueryWrapper);
QueryWrapper wrapper = new QueryWrapper<>();
- List dimMonthEntityList= dimMonthDao.selectList(wrapper);
- for(DimCustomerEntity customerEntity:customerEntityList){
- for(DimMonthEntity monthEntity:dimMonthEntityList) {
- calCpcIndexService.calCpcPartyAbility(customerEntity.getId(),monthEntity.getId());
+ List dimMonthEntityList = dimMonthDao.selectList(wrapper);
+ for (DimCustomerEntity customerEntity : customerEntityList) {
+ for (DimMonthEntity monthEntity : dimMonthEntityList) {
+ calCpcIndexService.calCpcPartyAbilityV2(customerEntity.getId(), monthEntity.getId());
}
}
}
+ log.error("手动调用党员相关-党建能力执行完毕======总耗时:{}ms,customerId:{}", System.currentTimeMillis() - startCpc, customerId);
return new Result();
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
index 1533d70143..c4f3f8f231 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
@@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
+import com.epmet.dto.extract.UserGroupIdDTO;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridGroupUserCountResultDTO;
@@ -225,4 +226,6 @@ public interface FactOriginGroupMainDailyDao extends BaseDao
*/
List selectPartyMemberGroupStaticByGrid(@Param("customerId") String customerId, @Param("dateId") String dateId);
+
+ List selectGroupAndLeader(String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java
index cb9552dd4d..48cf376478 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java
@@ -1,7 +1,5 @@
package com.epmet.service.evaluationindex.extract.dataToIndex;
-import java.util.Map;
-
/**
* 党员相关
*
@@ -18,4 +16,7 @@ public interface CalCpcIndexService {
* @Date 2020/9/17 14:08
**/
void calCpcPartyAbility(String customerId, String monthId);
+
+
+ void calCpcPartyAbilityV2(String customerId, String monthId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java
index b78ebc1588..7694f0cb87 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java
@@ -1,7 +1,10 @@
package com.epmet.service.evaluationindex.extract.dataToIndex.impl;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.ExceptionUtils;
+import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
+import com.epmet.dto.extract.UserGroupIdDTO;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService;
@@ -9,8 +12,10 @@ import com.epmet.service.evaluationindex.extract.todata.*;
import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.stats.DimCustomerPartymemberService;
+import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,6 +25,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
/**
* 党员相关
@@ -134,6 +141,237 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
factIndexPartyAblityCpcMonthlyService.delAndSavePartyAblityCpcMonthly(customerId,monthId,indexPartyAblityCpcList);
}
+ @Override
+ public void calCpcPartyAbilityV2(String customerId, String monthId) {
+ //1、构造初始值 当前客户下所有的党员
+ List indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId);
+ if (CollectionUtils.isEmpty(indexPartyAblityCpcList)) {
+ log.info("dim_customer_partymember do not any records customerId=" + customerId);
+ return;
+ }
+
+ //可以先查询出每个党员的 自建群
+ Map> userCreatedGroups = queryUserCreatedGroups(customerId, indexPartyAblityCpcList);
+
+ CompletableFuture