Browse Source

Merge remote-tracking branch 'remotes/origin/dev_data_stats' into dev

dev_shibei_match
jianjun 5 years ago
parent
commit
e507f289b8
  1. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java
  2. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java
  3. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java
  4. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  5. 272
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  6. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java
  7. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java
  8. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml
  9. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java

@ -90,14 +90,15 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
//注册用户
userSummaryInfoResultDTO=userAnalysisDao.selectRegUserSummaryInfo(myAgencyId);
}
if(null!=userSummaryInfoResultDTO){
if (userSummaryInfoResultDTO == null){
return new UserSummaryInfoResultDTO();
}
userSummaryInfoResultDTO.setCurrentDate(DateUtils.getxAxisDatePattern(userSummaryInfoResultDTO.getCurrentDate(),"."));
//提取出工具类
String partyMemberProStr=userSummaryInfoResultDTO.getPartymemberProportionValue().setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
userSummaryInfoResultDTO.setPartymemberProportion(partyMemberProStr.concat("%"));
String warmProStr=userSummaryInfoResultDTO.getWarmHeartedProportionValue().setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
userSummaryInfoResultDTO.setWarmHeartedProportion(warmProStr.concat("%"));
}
logger.info(String.format("查询用户汇总信息返参%s",JSON.toJSONString(userSummaryInfoResultDTO)));
return userSummaryInfoResultDTO;
}

42
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<TagCustomerEntity> {
/**
* desc:获取需要初始化的客户标签
*
* @param customerId
* @return
*/
List<TagCustomerEntity> getTagDefaultList(@Param("customerId") String customerId);
}

53
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -148,12 +148,11 @@ public class StatsGroupServiceImpl implements StatsGroupService {
String agencyId = agency.getId();
agencyResult.setAgencyId(agencyId);
agencyResult.setCustomerId(customerId);
agencyResult.setPid(agency.getPid());
BeanUtils.copyProperties(timeDim,agencyResult);
//机关下的所有网格(包括直属网格)
List<String> allGrid = this.getAllGrid(agencyId,customerId);
if (allGrid.size() != NumConstant.ZERO) {
String pidByAgencyId = dimAgencyService.getPidByAgencyId(agencyId);
agencyResult.setPid(StringUtils.isBlank(pidByAgencyId) ? "0" : pidByAgencyId);
// 1. 机关下有多少网格
List<GridIdListByCustomerResultDTO> customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId);
AtomicReference<Integer> gridSize = new AtomicReference<>(0);

272
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<DimAgencyEntity> 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<String, DimAgencyEntity> dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o));
List<DimGridEntity> gridDTOList = dimGridService.getGridListByCustomerId(customerId);
if (CollectionUtils.isEmpty(gridDTOList)) {
log.warn("statsTagUsedDaily getGridListByCustomerId return empty,customerId:{}", customerId);
}
List<DimDepartmentEntity> departmentDTOList = dimDepartmentService.getDepartmentListByCustomerId(customerId);
if (CollectionUtils.isEmpty(departmentDTOList)) {
log.warn("statsTagUsedDaily getDepartmentListByCustomerId return empty,customerId:{}", customerId);
}
//转换为 需要插入的Entity key gridId_tagId
Map<String, FactTagUsedGridDailyEntity> tagUsedGridDailyMap = new HashMap<>();
Map<String, FactTagUsedDepartmentDailyEntity> tagUsedDeptDailyMap = new HashMap<>();
Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailyMap = new HashMap<>();
Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailySelfMap = new HashMap<>();
//默认标签
buildDefaultUsedTag(dimIdBean, customerId, agencyDTOList, gridDTOList, departmentDTOList, tagUsedGridDailyMap, tagUsedDeptDailyMap, tagUsedAgencyDailyMap, tagUsedAgencyDailySelfMap);
//转换为 需要插入的Entity
Map<String, DimAgencyEntity> dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o));
//获取当天的业务数据
//1获取文章及机关id,网格Id
List<ArticleEntity> publishedArticleList = articleService.getPublishedArticleByPublishTime(customerId, DateUtils.format(statsDate));
if (CollectionUtils.isEmpty(publishedArticleList)) {
return;
}
//KEY 文章Id
Map<String, ArticleEntity> 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<ArticleTagsEntity> 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<String, ArticleEntity> 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<ArticleTagsEntity> 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<DimAgencyEntity> agencyDTOList, List<DimGridEntity> gridDTOList, List<DimDepartmentEntity> departmentDTOList, Map<String, FactTagUsedGridDailyEntity> tagUsedGridDailyMap, Map<String, FactTagUsedDepartmentDailyEntity> tagUsedDeptDailyMap, Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailyMap, Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailySelfMap) {
List<TagCustomerEntity> 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<DimGridEntity> dimGridList = dimGridService.getGridListByCustomerId(customerId);
if (CollectionUtils.isEmpty(dimGridList)) {
log.debug("statsTagViewedDaily customerId:{} have any grid", customerId);
return;
}
Map<String, DimGridEntity> dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o));
//转换为 需要插入的Entity
Map<String, DimAgencyEntity> dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o));
//转换为 需要插入的Entity key gridId_tagId
Map<String, FactTagViewedGridDailyEntity> tagViewedGridDailyMap = new HashMap<>();
Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailyMap = new HashMap<>();
Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailySelfMap = new HashMap<>();
//默认标签
buildDefaultViewedTag(dimIdBean, customerId, agencyDTOList, dimGridList, tagViewedGridDailyMap, tagViewedAgencyDailyMap, tagViewedAgencyDailySelfMap);
Map<String, DimGridEntity> dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o));
//转换为 需要插入的Entity
Map<String, DimAgencyEntity> 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<ArticleViewedSummaryDTO> visitRecordList = articleVisitRecordService.getArticleVisitByCreateTime(customerId, startTime, endTime);
if (CollectionUtils.isEmpty(visitRecordList)) {
return;
}
for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) {
List<ArticleTagsEntity> 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<ArticleTagsEntity> 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<DimAgencyEntity> agencyDTOList, List<DimGridEntity> dimGridList, Map<String, FactTagViewedGridDailyEntity> tagViewedGridDailyMap, Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailyMap, Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailySelfMap) {
List<TagCustomerEntity> 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<String, FactTagUsedGridDailyEntity> convertTagUsedGridDailyEntity(List<DimGridEntity> dimGridEntities, DimIdGenerator.DimIdBean dimIdBean) {
Map<String, FactTagUsedGridDailyEntity> 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<String, FactTagUsedGridDailyEntity> result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) {
String gridId = articleEntity.getPublisherId();
String tagId = tagEntity.getTagId();

34
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<TagCustomerEntity> {
List<TagCustomerEntity> getTagDefaultList(String customerId);
}

44
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<TagCustomerDao, TagCustomerEntity> implements TagCustomerService {
@Override
public List<TagCustomerEntity> getTagDefaultList(String customerId) {
return baseDao.getTagDefaultList(customerId);
}
}

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.voice.TagCustomerDao">
<select id="getTagDefaultList" resultType="com.epmet.entity.voice.TagCustomerEntity">
SELECT
ID,
TAG_NAME
FROM
tag_customer
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND CREATED_BY = 'default'
</select>
</mapper>

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -502,7 +502,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//5、给用户发送消息???待定
//6、新增小组缓存信息、组员缓存信息
Map<String, Object> param = new HashMap<>();
param.put(ModuleConstant.RESI_GROUP_ID_CAMEL, resiGroupDTO.getId());
param.put(ModuleConstant.RESI_GROUP_ID, resiGroupDTO.getId());
param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR);
List<ResiGroupStatisticalDTO> statisticalList = resiGroupStatisticalService.list(param);
if (null != statisticalList && statisticalList.size() > 0) {

Loading…
Cancel
Save