diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java index b8276891d2..d0e69169d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java @@ -60,5 +60,5 @@ public interface ActInfoDao{ * @author zxc * @date 2020/9/25 4:00 下午 */ - List selectActInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("orgType") String orgType,@Param("orgIds") List orgIds); + List selectActInfo(@Param("customerId") String customerId, @Param("monthId") String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 091b920adc..74f7b84d27 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -301,7 +301,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { // 查询客户下所有机关,网格下的参与人数 List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, null); // 查询机关界别的组织次数 - List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); + List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId); // 查询客户下所有网格和所有机关 List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); List screenPartyBranchDataListAgencyAll = gridService.selectAllGridIdToOrganize(customerId, monthId); @@ -315,11 +315,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); }); // 查询所有机关、网格组织次数 - List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, null, orgIds); if (isGrid == true){ agencyIdList.forEach(agency -> { finalResult.forEach(fl -> { - screenPartyBranchDataList.forEach(sp -> { + screenPartyBranchDataByAgencyList.forEach(sp -> { if (fl.getOrgId().equals(sp.getOrgId())){ fl.setOrganizeCount(sp.getOrganizeCount()); } @@ -374,7 +373,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (!CollectionUtils.isEmpty(disGridIds)){ orgIds.addAll(disGridIds); finalResult.forEach(r -> { - screenPartyBranchDataList.forEach(party ->{ + screenPartyBranchDataByAgencyList.forEach(party ->{ if (r.getOrgId().equals(party.getOrgId())){ r.setOrganizeCount(party.getOrganizeCount()); } @@ -397,7 +396,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setJoinUserCount(screenPartyBranchDataByParentList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); form.setOrganizeCount(screenPartyBranchDataByParentList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); // 如果存在本级名义的, 下级机关 + 本级 - screenPartyBranchDataByParentList.forEach(organize -> { + screenPartyBranchDataByAgencyList.forEach(organize -> { if (organize.getOrgId().equals(agencyId)) { form.setOrganizeCount(calAdd(organize.getOrganizeCount(), screenPartyBranchDataByParentList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); } 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)); + } + }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java index 959b237c75..c2817f6321 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java @@ -39,5 +39,5 @@ public interface ActInfoService { * @author zxc * @date 2020/9/25 4:00 下午 */ - List selectActInfo(String customerId, String monthId, String orgType, List orgIds); + List selectActInfo(String customerId, String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java index 7e65f078e3..038341d76c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java @@ -71,10 +71,7 @@ public class ActInfoServiceImpl implements ActInfoService { * @date 2020/9/25 4:00 下午 */ @Override - public List selectActInfo(String customerId, String monthId, String orgType, List orgIds) { - if (!CollectionUtils.isEmpty(orgIds)){ - return baseDao.selectActInfo(customerId, monthId, orgType, orgIds); - } - return new ArrayList<>(); + public List selectActInfo(String customerId, String monthId) { + return baseDao.selectActInfo(customerId, monthId); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml index 055d888c7c..c75ccf54d8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml @@ -51,15 +51,6 @@ AND ACT_STATUS = 'finished' AND CUSTOMER_ID = #{customerId} AND DATE_FORMAT( ACTUAL_END_TIME, '%Y%m' ) = #{monthId} - - AND SPONSOR_TYPE = #{orgType} - - AND - ( - - SPONSOR_ID = #{orgId} - - ) GROUP BY SPONSOR_ID