From 38b54b5189dcf1d57b4d915b2590460d1ffe883c Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 24 Jun 2020 17:16:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E7=BB=9F=E8=AE=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StatsIssueServiceImpl.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java index fd6ffe7b88..ab38ff305a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java @@ -4,6 +4,7 @@ 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.IssueConstant; +import com.epmet.constant.ProjectConstant; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; @@ -18,6 +19,7 @@ import com.epmet.service.StatsIssueService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -33,6 +35,7 @@ import java.util.stream.Collectors; * @dscription * @date 2020/6/17 16:51 */ +@Slf4j @Service public class StatsIssueServiceImpl implements StatsIssueService { @Autowired @@ -60,11 +63,17 @@ public class StatsIssueServiceImpl implements StatsIssueService { int pageSize = 100; List customerIdList = null; do { + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { //遍历统计每一个客户数据 - customerStats(customerId); + try { + customerStats(customerId, date); + } catch(Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", DateUtils.format(date), e.getMessage())); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -77,10 +86,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { * @param customerId * @return void */ - @Async - public void customerStats(String customerId) { - //获取当前日期前一天 - Date date = DateUtils.getBeforeDay(new Date()); + private void customerStats(String customerId, Date date) { //机关议题日统计 saveIssueAgencyDaily(customerId, date); //机关议题月统计