From 65629d13cae375ed740aee27742694e6576ea087 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 13:30:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E8=8E=B7=E5=8F=96=E5=AE=A2?= =?UTF-8?q?=E6=88=B7id=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/stats/DimCustomerDao.java | 8 ++-- .../epmet/service/StatsPublicityService.java | 4 +- .../impl/StatsPublicityServiceImpl.java | 42 +++++-------------- .../stats/impl/DimCustomerServiceImpl.java | 3 +- .../resources/mapper/stats/DimCustomerDao.xml | 2 +- 5 files changed, 19 insertions(+), 40 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java index 66ea22ad59..f8b317848c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.stats.DimCustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -35,12 +36,11 @@ public interface DimCustomerDao extends BaseDao { /** * desc: 分页获取客户id * - * @param pageNo - * @param offset - * return: List + * @param pageSize + * @param offset return: List * @date: 2020/6/17 16:33 * @author: jianjun liu * email:liujianjun@git.elinkit.com.cn */ - List selectCustomerIdPage(Integer pageNo, int offset); + List selectCustomerIdPage(@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java index 1a31ac74ad..6574563a45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java @@ -1,6 +1,8 @@ package com.epmet.service; +import java.util.Date; + public interface StatsPublicityService { /** * desc: 统计宣传能力的汇总信息 @@ -10,6 +12,6 @@ public interface StatsPublicityService { * @author: jianjun liu * email:liujianjun@git.elinkit.com.cn */ - Boolean publicitySummary(); + Boolean publicitySummary(Date statsDate); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index 5c27913655..b86c1ee772 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -3,7 +3,6 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; import com.epmet.entity.stats.DimGridEntity; -import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; import com.epmet.service.StatsPublicityService; import com.epmet.service.stats.*; import com.epmet.service.voice.ArticlePublishRangeService; @@ -47,52 +46,31 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService; @Override - public Boolean publicitySummary() { + public Boolean publicitySummary(Date statsDate) { + if (statsDate == null) { + statsDate = DateUtils.addDateDays(new Date(), -1); + } int pageNo = 1; int pageSize = 100; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { - customerIdList.forEach(customerId -> { - //获取所有网格 + for (String customerId : customerIdList) {//获取所有网格 List gridDTOList = dimGridService.getGridListByCustomerId(customerId); + if (!CollectionUtils.isEmpty(gridDTOList)) { + List publishedArticleCount = articlePublishRangeService.getAllPublishedCount(customerId, statsDate); + } - }); + } } } while (!CollectionUtils.isEmpty(customerIdList) || customerIdList.size() >= pageSize); return null; } private List statsPublishArticle(String customerId, Date statsDate) { - if (statsDate == null) { - statsDate = DateUtils.addDateDays(new Date(), -1); - } - //昨日的 dateId - String dateId = DateUtils.format(statsDate, DateUtils.DATE_PATTERN_YYYYMMDD); + List articleCount = articlePublishRangeService.getAllPublishedCount(customerId, statsDate); - //1.先查询昨天的 有没有数据 有则 昨日发布文章总数 = 昨日的发布文章数增量 + 统计表中已有的昨日的网格总数 ; - // 否则 昨日发布文章总数 = 发布范围表中计算所有发布文章总数 - List articleCount = null; - List gridBeforeData = factArticlePublishedGridDailyService.getByBeforeDay(customerId, dateId); - boolean selectAll = false; - if (CollectionUtils.isEmpty(gridBeforeData)){ - selectAll = true; - } - - if (selectAll) { - articleCount = articlePublishRangeService.getAllPublishedCount(customerId, statsDate); - } else { - Date startDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN); - Date endDate = DateUtils.integrate(DateUtils.addDateDays(startDate, 1), DateUtils.DATE_PATTERN); - articleCount = articlePublishRangeService.getOneDayPublishedCount(customerId, startDate, endDate); - //如果没有查到 - if (CollectionUtils.isEmpty(articleCount)){ - - } - //累加昨日的数据 - - } return articleCount; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java index 87ab6d789d..3ea9113a5d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java @@ -28,7 +28,6 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.stats.DimCustomerDao; import com.epmet.dto.stats.DimCustomerDTO; import com.epmet.entity.crm.CustomerEntity; -import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimCustomerEntity; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; @@ -109,7 +108,7 @@ public class DimCustomerServiceImpl extends BaseServiceImpl - select ID FROM dim_customer WHERE DEL_FLAG = '0' + select ID FROM dim_customer WHERE DEL_FLAG = '0' limit #{offset,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER} \ No newline at end of file