From b84d457f4aa125717a1eda20ff6d1ece6e862d9b Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 30 Jun 2020 11:02:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E8=A2=AB=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E8=A2=AB=E9=98=85=E8=AF=BB=E6=B7=BB=E5=8A=A0=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/voice/TagCustomerDao.java | 42 +++ .../epmet/entity/voice/TagCustomerEntity.java | 53 ++++ .../impl/StatsPublicityServiceImpl.java | 272 ++++++++++++------ .../service/voice/TagCustomerService.java | 34 +++ .../voice/impl/TagCustomerServiceImpl.java | 44 +++ .../resources/mapper/voice/TagCustomerDao.xml | 17 ++ 6 files changed, 375 insertions(+), 87 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java new file mode 100644 index 0000000000..15d8f18cbf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.voice; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.voice.TagCustomerEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +@Mapper +public interface TagCustomerDao extends BaseDao { + /** + * desc:获取需要初始化的客户标签 + * + * @param customerId + * @return + */ + List getTagDefaultList(@Param("customerId") String customerId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java new file mode 100644 index 0000000000..818e227cad --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java @@ -0,0 +1,53 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.voice; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tag_customer") +public class TagCustomerEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 使用计数 + */ + private Integer useCount; + +} 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 63751accec..241ca6ad2f 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 @@ -12,12 +12,13 @@ import com.epmet.dto.voice.ArticleViewedSummaryDTO; import com.epmet.entity.stats.*; import com.epmet.entity.voice.ArticleEntity; import com.epmet.entity.voice.ArticleTagsEntity; +import com.epmet.entity.voice.TagCustomerEntity; import com.epmet.service.StatsPublicityService; import com.epmet.service.stats.*; -import com.epmet.service.voice.ArticleOperateRecordService; import com.epmet.service.voice.ArticleService; import com.epmet.service.voice.ArticleTagsService; import com.epmet.service.voice.ArticleVisitRecordService; +import com.epmet.service.voice.TagCustomerService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -56,7 +57,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { @Autowired private ArticleVisitRecordService articleVisitRecordService; @Autowired - private ArticleOperateRecordService articleOperateRecordService; + private TagCustomerService tagCustomerService; @Autowired private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService; @Autowired @@ -528,54 +529,64 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //获取所有网格 List agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId); if (CollectionUtils.isEmpty(agencyDTOList)) { - log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); + log.warn("statsTagUsedDaily getAgencyListByCustomerId return empty,customerId:{}", customerId); return; } - //转换为 需要插入的Entity - Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + List gridDTOList = dimGridService.getGridListByCustomerId(customerId); + if (CollectionUtils.isEmpty(gridDTOList)) { + log.warn("statsTagUsedDaily getGridListByCustomerId return empty,customerId:{}", customerId); + } + List departmentDTOList = dimDepartmentService.getDepartmentListByCustomerId(customerId); + if (CollectionUtils.isEmpty(departmentDTOList)) { + log.warn("statsTagUsedDaily getDepartmentListByCustomerId return empty,customerId:{}", customerId); + } //转换为 需要插入的Entity key gridId_tagId Map tagUsedGridDailyMap = new HashMap<>(); Map tagUsedDeptDailyMap = new HashMap<>(); Map tagUsedAgencyDailyMap = new HashMap<>(); Map tagUsedAgencyDailySelfMap = new HashMap<>(); + + //默认标签 + buildDefaultUsedTag(dimIdBean, customerId, agencyDTOList, gridDTOList, departmentDTOList, tagUsedGridDailyMap, tagUsedDeptDailyMap, tagUsedAgencyDailyMap, tagUsedAgencyDailySelfMap); + //转换为 需要插入的Entity + Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + //获取当天的业务数据 //1获取文章及机关id,网格Id List publishedArticleList = articleService.getPublishedArticleByPublishTime(customerId, DateUtils.format(statsDate)); - if (CollectionUtils.isEmpty(publishedArticleList)) { - return; - } - //KEY 文章Id - Map articleMap = publishedArticleList.stream().collect(Collectors.toMap(ArticleEntity::getId, o -> o)); - Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); - Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); - //2 获取文章标签 - List articleTagsList = articleTagsService.getArticleTagsByCreateTime(customerId, startTime, endTime); - if (CollectionUtils.isEmpty(articleTagsList)) { - log.error("publicitySummary getArticleTagsByCreateTime customerId:{} have not articleTags,publishedArticleList:{}", customerId, JSON.toJSONString(publishedArticleList)); - return; - } - //tagId - for (ArticleTagsEntity tagEntity : articleTagsList) { - ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); - if (articleEntity == null) { - log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); - return; - } - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); - convertTagUsedAgencyDailyEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailyMap, articleEntity, tagEntity, dimIdBean); - switch (articleEntity.getPublisherType()) { - case ProjectConstant.PUBLISHER_TYPE_GRID: - convertTagUsedGridDailyEntity(tagUsedGridDailyMap, articleEntity, tagEntity, dimIdBean); - break; - case ProjectConstant.PUBLISHER_TYPE_DEPT: - convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean); - break; - case ProjectConstant.PUBLISHER_TYPE_AGENCY: - convertTagUsedAgencyDailySelfEntity( tagUsedAgencyDailySelfMap, articleEntity, tagEntity, dimIdBean); - break; + if (!CollectionUtils.isEmpty(publishedArticleList)) { + //KEY 文章Id + Map articleMap = publishedArticleList.stream().collect(Collectors.toMap(ArticleEntity::getId, o -> o)); + Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); + Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + //2 获取文章标签 + List articleTagsList = articleTagsService.getArticleTagsByCreateTime(customerId, startTime, endTime); + if (!CollectionUtils.isEmpty(articleTagsList)) { + //tagId + for (ArticleTagsEntity tagEntity : articleTagsList) { + ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); + if (articleEntity == null) { + log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); + continue; + } + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); + convertTagUsedAgencyDailyEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailyMap, articleEntity, tagEntity, dimIdBean); + switch (articleEntity.getPublisherType()) { + case ProjectConstant.PUBLISHER_TYPE_GRID: + convertTagUsedGridDailyEntity(tagUsedGridDailyMap, articleEntity, tagEntity, dimIdBean); + break; + case ProjectConstant.PUBLISHER_TYPE_DEPT: + convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean); + break; + case ProjectConstant.PUBLISHER_TYPE_AGENCY: + convertTagUsedAgencyDailySelfEntity(tagUsedAgencyDailySelfMap, articleEntity, tagEntity, dimIdBean); + break; + } + } } } + factTagUsedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedGridDailyMap.values()); factTagUsedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedDeptDailyMap.values()); //向上级机关递归添加 数据 @@ -598,6 +609,64 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { } + private void buildDefaultUsedTag(DimIdGenerator.DimIdBean dimIdBean, String customerId, List agencyDTOList, List gridDTOList, List departmentDTOList, Map tagUsedGridDailyMap, Map tagUsedDeptDailyMap, Map tagUsedAgencyDailyMap, Map tagUsedAgencyDailySelfMap) { + List tagDefaultList = tagCustomerService.getTagDefaultList(customerId); + if (!CollectionUtils.isEmpty(tagDefaultList)) { + agencyDTOList.forEach(agency -> { + if (!CollectionUtils.isEmpty(gridDTOList)) { + gridDTOList.forEach(grid -> { + tagDefaultList.forEach(tag -> { + FactTagUsedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedGridDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setGridId(grid.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(0); + tagUsedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + + }); + } + if (!CollectionUtils.isEmpty(departmentDTOList)) { + departmentDTOList.forEach(dept -> { + tagDefaultList.forEach(tag -> { + FactTagUsedDepartmentDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedDepartmentDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setDepartmentId(dept.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(0); + tagUsedDeptDailyMap.put(dept.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + tagDefaultList.forEach(tag -> { + FactTagUsedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); + entity.setPid(agency.getPid()); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(0); + tagUsedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + tagDefaultList.forEach(tag -> { + FactTagUsedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); + entity.setPid(agency.getId()); + entity.setCustomerId(customerId); + String agencyId = agency.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); + entity.setAgencyId(agencyId); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(0); + tagUsedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + } + /** * desc:按日统计 标签被阅读的次数 * @@ -621,50 +690,52 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { List dimGridList = dimGridService.getGridListByCustomerId(customerId); if (CollectionUtils.isEmpty(dimGridList)) { log.debug("statsTagViewedDaily customerId:{} have any grid", customerId); - return; } - Map dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o)); - //转换为 需要插入的Entity - Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + //转换为 需要插入的Entity key gridId_tagId Map tagViewedGridDailyMap = new HashMap<>(); Map tagViewedAgencyDailyMap = new HashMap<>(); Map tagViewedAgencyDailySelfMap = new HashMap<>(); + + //默认标签 + buildDefaultViewedTag(dimIdBean, customerId, agencyDTOList, dimGridList, tagViewedGridDailyMap, tagViewedAgencyDailyMap, tagViewedAgencyDailySelfMap); + Map dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o)); + //转换为 需要插入的Entity + Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + //获取当天的业务数据 //1获取今天文章的阅读记录数 Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); List visitRecordList = articleVisitRecordService.getArticleVisitByCreateTime(customerId, startTime, endTime); - if (CollectionUtils.isEmpty(visitRecordList)) { - return; - } - - for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) { - List articleTagsList = articleTagsService.getArticleTagsByArticleId(customerId, viewedSummaryDTO.getArticleId()); - if (CollectionUtils.isEmpty(articleTagsList)) { - continue; - } - ArticleEntity articleEntity = articleService.selectArticleById(viewedSummaryDTO.getArticleId()); - if (articleEntity == null) { - continue; - } - boolean isAgencyPublished = false; - if (ProjectConstant.PUBLISHER_TYPE_AGENCY.equals(articleEntity.getPublisherType())) { - isAgencyPublished = true; - } - String gridId = viewedSummaryDTO.getGridId(); - DimGridEntity dimGridEntity = dimGridEntityMap.get(gridId); + if (!CollectionUtils.isEmpty(visitRecordList)) { + for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) { + List articleTagsList = articleTagsService.getArticleTagsByArticleId(customerId, viewedSummaryDTO.getArticleId()); + if (CollectionUtils.isEmpty(articleTagsList)) { + continue; + } + ArticleEntity articleEntity = articleService.selectArticleById(viewedSummaryDTO.getArticleId()); + if (articleEntity == null) { + continue; + } + boolean isAgencyPublished = false; + if (ProjectConstant.PUBLISHER_TYPE_AGENCY.equals(articleEntity.getPublisherType())) { + isAgencyPublished = true; + } + String gridId = viewedSummaryDTO.getGridId(); + DimGridEntity dimGridEntity = dimGridEntityMap.get(gridId); - if (dimGridEntity == null) { - log.error("statsTagViewedDaily viewedRecord gridId:{} not exist in dimGridMap", gridId); - continue; - } - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(dimGridEntity.getAgencyId()); - for (ArticleTagsEntity articleTag : articleTagsList) { - convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean); - convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean); - if (isAgencyPublished) { - convertTagViewedAgencyDailySelfEntity(dimAgencyEntity, tagViewedAgencyDailySelfMap, articleTag, viewedSummaryDTO, dimIdBean); + if (dimGridEntity == null) { + log.error("statsTagViewedDaily viewedRecord gridId:{} not exist in dimGridMap", gridId); + continue; + } + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(dimGridEntity.getAgencyId()); + for (ArticleTagsEntity articleTag : articleTagsList) { + convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean); + convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean); + if (isAgencyPublished) { + convertTagViewedAgencyDailySelfEntity(dimAgencyEntity, tagViewedAgencyDailySelfMap, articleTag, viewedSummaryDTO, dimIdBean); + } } } } @@ -679,7 +750,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { FactTagViewedAgencyDailyEntity currentEntity = entry.getValue(); DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(currentEntity.getAgencyId()); if (dimAgencyEntity == null) { - log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", agencyId); continue; } @@ -691,6 +761,50 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { factTagViewedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); } + private void buildDefaultViewedTag(DimIdGenerator.DimIdBean dimIdBean, String customerId, List agencyDTOList, List dimGridList, Map tagViewedGridDailyMap, Map tagViewedAgencyDailyMap, Map tagViewedAgencyDailySelfMap) { + List tagDefaultList = tagCustomerService.getTagDefaultList(customerId); + if (!CollectionUtils.isEmpty(tagDefaultList)) { + agencyDTOList.forEach(agency -> { + if (!CollectionUtils.isEmpty(dimGridList)) { + dimGridList.forEach(grid -> { + tagDefaultList.forEach(tag -> { + FactTagViewedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedGridDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setGridId(grid.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(0); + tagViewedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + + }); + } + tagDefaultList.forEach(tag -> { + FactTagViewedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); + entity.setPid(agency.getPid()); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(0); + tagViewedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + tagDefaultList.forEach(tag -> { + FactTagViewedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); + entity.setPid(agency.getId()); + entity.setCustomerId(customerId); + String agencyId = agency.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); + entity.setAgencyId(agencyId); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(0); + tagViewedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + } + /** * desc:按月统计 标签使用数 * @@ -972,25 +1086,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { /** * desc:将网格对象构建为 tagUsedGridDaily 对象 * - * @param dimGridEntities * @param dimIdBean * @return */ - private Map convertTagUsedGridDailyEntity(List dimGridEntities, DimIdGenerator.DimIdBean dimIdBean) { - Map result = new HashMap<>(); - dimGridEntities.forEach(dimGridEntity -> { - FactTagUsedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedGridDailyEntity.class); - entity.setCustomerId(dimGridEntity.getCustomerId()); - entity.setAgencyId(dimGridEntity.getAgencyId()); - entity.setGridId(dimGridEntity.getId()); - entity.setTagId(""); - entity.setTagName(""); - entity.setUsedCount(0); - result.put(dimGridEntity.getId(), entity); - }); - return result; - } - private void convertTagUsedGridDailyEntity(Map result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) { String gridId = articleEntity.getPublisherId(); String tagId = tagEntity.getTagId(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java new file mode 100644 index 0000000000..609d68cf5c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.voice.TagCustomerEntity; + +import java.util.List; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +public interface TagCustomerService extends BaseService { + + List getTagDefaultList(String customerId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java new file mode 100644 index 0000000000..36e872429e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.voice.TagCustomerDao; +import com.epmet.entity.voice.TagCustomerEntity; +import com.epmet.service.voice.TagCustomerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +@Service +@DataSource(DataSourceConstant.GOV_VOICE) +public class TagCustomerServiceImpl extends BaseServiceImpl implements TagCustomerService { + + @Override + public List getTagDefaultList(String customerId) { + return baseDao.getTagDefaultList(customerId); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml new file mode 100644 index 0000000000..73defbbf6b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file