From e38e3d2f08d052265309528858153c51a9733c4b Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 29 Sep 2020 11:09:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=9C=88=E6=8A=BD=E5=8F=96=20?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E8=AE=A1=E7=AE=97=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ScreenExtractServiceImpl.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index e1594766df..5038508c51 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -1,10 +1,13 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.*; +import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -15,6 +18,8 @@ import org.springframework.util.CollectionUtils; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * @Author zxc @@ -40,6 +45,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private GovernRankDataExtractService governRankDataExtractService; @Autowired private PublicPartiTotalDataExtractService publicPartiTotalDataExtractService; + @Autowired + private IndexCalculateService indexCalculateService; /** * @param extractOriginFormDTO @@ -146,5 +153,18 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { orgRankExtractService.extractDistrictData(customerId, monthId); // 党建引领 screen_party_branch_data,screen_party_link_masses_data partyGuideService.partyGuideExtract(formDTO); + + //计算分数 todo 优化 手动创建线程池 控制任务数量 + ExecutorService pool = Executors.newSingleThreadExecutor(); + pool.submit(() -> { + CalculateCommonFormDTO formDTO1 = new CalculateCommonFormDTO(); + try { + formDTO1.setMonthId(monthId); + formDTO1.setCustomerId(customerId); + indexCalculateService.indexCalculate(formDTO1); + } catch (Exception e) { + log.error("extractMonthly 计算分数异常,参数:{}", JSON.toJSONString(formDTO1)); + } + }); } }