|
|
@ -29,7 +29,6 @@ import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -104,21 +103,19 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
private FactTagViewedGridYearlyService factTagViewedGridYearlyService; |
|
|
|
@Autowired |
|
|
|
private FactTagViewedAgencyYearlyService factTagViewedAgencyYearlyService; |
|
|
|
@Autowired |
|
|
|
private ExecutorService executorService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean articleSummaryDailyStatsjob(Date statsDate) { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//查询的是昨天及以前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
String statsDateStr = DateUtils.format(statsDate); |
|
|
|
do { |
|
|
@ -147,13 +144,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -177,13 +174,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -192,7 +189,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
try { |
|
|
|
statsTagUsedMonthly(dimIdBean.getMonthId(), customerId); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "按月统计标签被使用次数", customerId, dimIdBean.getMonthId()), e); |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedMonthlyStatsjob", customerId, dimIdBean.getMonthId()), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -206,13 +203,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -234,13 +231,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -262,13 +259,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -297,13 +294,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
|
|
|
|
if (statsDate == null) { |
|
|
|
//当天的凌晨时间 即为今天之前的数据
|
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); |
|
|
|
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
} else { |
|
|
|
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
} |
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); |
|
|
|
int pageNo = 1; |
|
|
|
int pageSize = 100; |
|
|
|
int pageNo = NumConstant.ONE; |
|
|
|
int pageSize = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
@ -318,8 +315,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
try { |
|
|
|
log.debug("start === statsTagViewedYearly "); |
|
|
|
statsTagViewedYearly(dimIdBean.getYearId(), customerId); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getYearId()), e); |
|
|
|
} |
|
|
@ -357,7 +352,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
buildAgencySummaryData(agencySummaryMap, summaryDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); |
|
|
|
factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedDepartmentDaily", customerId, statsDate), e); |
|
|
|
} |
|
|
@ -430,8 +425,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedGridDaily", customerId, statsDate), e); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void statsPublishedAgencyDaily(String statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap) { |
|
|
@ -460,9 +453,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); |
|
|
|
gridDailyEntities.setPublishedCount(summaryDTO.getPublishedCount()); |
|
|
|
|
|
|
|
|
|
|
|
haveDataAgencyDailyMap.put(summaryDTO.getAgencyId(), gridDailyEntities); |
|
|
|
|
|
|
|
//构建机关自己的数据
|
|
|
|
FactArticlePublishedAgencyDailyEntity selfDaily = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedAgencyDailyEntity.class); |
|
|
|
selfDaily.setCustomerId(gridDailyEntities.getCustomerId()); |
|
|
@ -506,9 +497,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
agencyDailyEntityMap.putAll(haveDataAgencyDailySelfMap); |
|
|
|
} |
|
|
|
log.debug("statsPublishedAgencyDaily insert:{}", JSON.toJSONString(agencyDailyEntityMap.values())); |
|
|
|
boolean b = factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); |
|
|
|
factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedAgencyDaily", customerId, statsDate), e); |
|
|
|
} |
|
|
|
} |
|
|
@ -558,7 +548,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//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); |
|
|
|
Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
//2 获取文章标签
|
|
|
|
List<ArticleTagsEntity> articleTagsList = articleTagsService.getArticleTagsByCreateTime(customerId, startTime, endTime); |
|
|
|
if (!CollectionUtils.isEmpty(articleTagsList)) { |
|
|
@ -586,14 +576,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
factTagUsedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedGridDailyMap.values()); |
|
|
|
factTagUsedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedDeptDailyMap.values()); |
|
|
|
//向上级机关递归添加 数据
|
|
|
|
Map<String, FactTagUsedAgencyDailyEntity> finalTagUsedAgencyDailyMap = new HashMap<>(); |
|
|
|
finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailyMap); |
|
|
|
List<FactTagUsedAgencyDailyEntity> agencyDailyEntities = tagUsedAgencyDailyMap.values().stream().filter(uesedTag -> uesedTag.getUsedCount() > 0).collect(Collectors.toList()); |
|
|
|
log.debug("===tagUsedAgencyDailyMap:"+JSON.toJSONString(tagUsedAgencyDailyMap.values().stream().filter(o->o.getUsedCount()>0).collect(Collectors.toList()))); |
|
|
|
List<FactTagUsedAgencyDailyEntity> agencyDailyEntities = tagUsedAgencyDailyMap.values().stream().filter(uesedTag -> uesedTag.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()); |
|
|
|
log.debug("===tagUsedAgencyDailyMap:" + JSON.toJSONString(tagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); |
|
|
|
for (FactTagUsedAgencyDailyEntity entry : agencyDailyEntities) { |
|
|
|
DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(entry.getAgencyId()); |
|
|
|
if (dimAgencyEntity == null) { |
|
|
@ -602,11 +591,11 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} |
|
|
|
setTagUsedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, entry, dimIdBean); |
|
|
|
} |
|
|
|
log.debug("===finalTagUsedAgencyDailyMap:"+JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o->o.getUsedCount()>0).collect(Collectors.toList()))); |
|
|
|
log.debug("===finalTagUsedAgencyDailyMap:" + JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); |
|
|
|
if (!CollectionUtils.isEmpty(tagUsedAgencyDailySelfMap)) { |
|
|
|
finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailySelfMap); |
|
|
|
} |
|
|
|
log.debug("===finalTagUsedAgencyDailyMap:"+JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o->o.getUsedCount()>0).collect(Collectors.toList()))); |
|
|
|
log.debug("===finalTagUsedAgencyDailyMap:" + JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); |
|
|
|
factTagUsedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); |
|
|
|
|
|
|
|
} |
|
|
@ -624,7 +613,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setGridId(grid.getId()); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setUsedCount(0); |
|
|
|
entity.setUsedCount(NumConstant.ZERO); |
|
|
|
tagUsedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
|
|
|
@ -639,7 +628,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setDepartmentId(dept.getId()); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setUsedCount(0); |
|
|
|
entity.setUsedCount(NumConstant.ZERO); |
|
|
|
tagUsedDeptDailyMap.put(dept.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -651,7 +640,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agency.getId()); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setUsedCount(0); |
|
|
|
entity.setUsedCount(NumConstant.ZERO); |
|
|
|
tagUsedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
tagDefaultList.forEach(tag -> { |
|
|
@ -662,7 +651,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agencyId); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setUsedCount(0); |
|
|
|
entity.setUsedCount(NumConstant.ZERO); |
|
|
|
tagUsedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -708,7 +697,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//获取当天的业务数据
|
|
|
|
//1获取今天文章的阅读记录数
|
|
|
|
Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); |
|
|
|
Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); |
|
|
|
Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, NumConstant.ONE), DateUtils.DATE_PATTERN); |
|
|
|
List<ArticleViewedSummaryDTO> visitRecordList = articleVisitRecordService.getArticleVisitByCreateTime(customerId, startTime, endTime); |
|
|
|
if (!CollectionUtils.isEmpty(visitRecordList)) { |
|
|
|
for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) { |
|
|
@ -747,7 +736,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
//向上级机关递归添加 数据
|
|
|
|
Map<String, FactTagViewedAgencyDailyEntity> finalTagUsedAgencyDailyMap = new HashMap<>(); |
|
|
|
finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailyMap); |
|
|
|
List<FactTagViewedAgencyDailyEntity> tagViewedList = tagViewedAgencyDailyMap.values().stream().filter(tagViewed -> tagViewed.getTagReadCount() > 0).collect(Collectors.toList()); |
|
|
|
List<FactTagViewedAgencyDailyEntity> tagViewedList = tagViewedAgencyDailyMap.values().stream().filter(tagViewed -> tagViewed.getTagReadCount() > NumConstant.ZERO).collect(Collectors.toList()); |
|
|
|
for (FactTagViewedAgencyDailyEntity entry : tagViewedList) { |
|
|
|
DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(entry.getAgencyId()); |
|
|
|
if (dimAgencyEntity == null) { |
|
|
@ -775,10 +764,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setGridId(grid.getId()); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setTagReadCount(0); |
|
|
|
entity.setTagReadCount(NumConstant.ZERO); |
|
|
|
tagViewedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
tagDefaultList.forEach(tag -> { |
|
|
@ -788,7 +776,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agency.getId()); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setTagReadCount(0); |
|
|
|
entity.setTagReadCount(NumConstant.ZERO); |
|
|
|
tagViewedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
tagDefaultList.forEach(tag -> { |
|
|
@ -799,7 +787,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agencyId); |
|
|
|
entity.setTagId(tag.getId()); |
|
|
|
entity.setTagName(tag.getTagName()); |
|
|
|
entity.setTagReadCount(0); |
|
|
|
entity.setTagReadCount(NumConstant.ZERO); |
|
|
|
tagViewedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -837,7 +825,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedMonthly(String monthId, String customerId) { |
|
|
|
|
|
|
|
List<FactTagViewedGridDailyEntity> gridDailyList = factTagViewedGridDailyService.getTagViewedCountByMonth(customerId, monthId); |
|
|
|
if (!CollectionUtils.isEmpty(gridDailyList)) { |
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = ConvertUtils.sourceToTarget(gridDailyList, FactTagViewedGridMonthlyEntity.class); |
|
|
@ -849,7 +836,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList = ConvertUtils.sourceToTarget(agencyDailyList, FactTagViewedAgencyMonthlyEntity.class); |
|
|
|
factTagViewedAgencyMonthlyService.deleteAndInsertByMonthId(customerId, monthId, (agencyMonthlyList)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -859,7 +845,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagUsedQuarterly(String quarterId, String customerId) { |
|
|
|
|
|
|
|
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagUsedGridQuarterlyEntity> gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridQuarterlyEntity.class); |
|
|
@ -875,7 +860,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagUsedAgencyQuarterlyEntity> agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyQuarterlyEntity.class); |
|
|
|
factTagUsedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, agencyQuarterlyList); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -885,19 +869,16 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedQuarterly(String quarterId, String customerId) { |
|
|
|
|
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = factTagViewedGridMonthlyService.getTagViewedCountByQuarterId(customerId, quarterId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagViewedGridQuarterlyEntity> gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagViewedGridQuarterlyEntity.class); |
|
|
|
factTagViewedGridQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, gridQuarterlyList); |
|
|
|
} |
|
|
|
|
|
|
|
List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList = factTagViewedAgencyMonthlyService.getTagViewedCountByQuarterId(customerId, quarterId); |
|
|
|
if (!CollectionUtils.isEmpty(agencyMonthlyList)) { |
|
|
|
List<FactTagViewedAgencyQuarterlyEntity> agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyQuarterlyEntity.class); |
|
|
|
factTagViewedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, agencyQuarterlyList); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -907,7 +888,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagUsedYearly(String yearId, String customerId) { |
|
|
|
|
|
|
|
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByYearId(customerId, yearId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagUsedGridYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridYearlyEntity.class); |
|
|
@ -923,7 +903,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagUsedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyYearlyEntity.class); |
|
|
|
factTagUsedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -933,8 +912,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedYearly(String yearId, String customerId) { |
|
|
|
|
|
|
|
|
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = factTagViewedGridMonthlyService.getTagViewedCountByYearId(customerId, yearId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagViewedGridYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagViewedGridYearlyEntity.class); |
|
|
@ -945,7 +922,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagViewedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyYearlyEntity.class); |
|
|
|
factTagViewedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void setTagUsedData2ParentAgency(Map<String, DimAgencyEntity> dimAgencyEntityMap, Map<String, FactTagUsedAgencyDailyEntity> agencyDailyEntityMap, FactTagUsedAgencyDailyEntity currentEntity, DimIdGenerator.DimIdBean dimIdBean) { |
|
|
@ -982,6 +958,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
FactTagViewedAgencyDailyEntity parentAgencyDailyEntity = agencyDailyEntityMap.get(key); |
|
|
|
DimAgencyEntity currentDimAgency = dimAgencyEntityMap.get(pid); |
|
|
|
if (currentDimAgency == null) { |
|
|
|
log.error("setTagViewedData2ParentAgency pid:{} not exist in dimAgency", pid); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (parentAgencyDailyEntity == null) { |
|
|
@ -1006,6 +983,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
String pid = summary.getPid(); |
|
|
|
FactArticlePublishedAgencyDailyEntity parentAgency = agencyDailyEntityMap.get(pid); |
|
|
|
if (parentAgency == null) { |
|
|
|
log.error("setPublishedData2ParentAgency pid:{} not exist in dimAgency", pid); |
|
|
|
return; |
|
|
|
} |
|
|
|
parentAgency.setArticleTotalCount(parentAgency.getArticleTotalCount() + agencySummary.getArticleTotalCount()); |
|
|
@ -1031,9 +1009,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setCustomerId(dimGridEntity.getCustomerId()); |
|
|
|
entity.setAgencyId(dimGridEntity.getAgencyId()); |
|
|
|
entity.setGridId(dimGridEntity.getId()); |
|
|
|
entity.setArticleTotalCount(0); |
|
|
|
entity.setArticlePublishedCount(0); |
|
|
|
entity.setPublishedCount(0); |
|
|
|
entity.setArticleTotalCount(NumConstant.ZERO); |
|
|
|
entity.setArticlePublishedCount(NumConstant.ZERO); |
|
|
|
entity.setPublishedCount(NumConstant.ZERO); |
|
|
|
result.put(dimGridEntity.getId(), entity); |
|
|
|
}); |
|
|
|
return result; |
|
|
@ -1053,9 +1031,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setCustomerId(dimGridEntity.getCustomerId()); |
|
|
|
entity.setAgencyId(dimGridEntity.getAgencyId()); |
|
|
|
entity.setDepartmentId(dimGridEntity.getId()); |
|
|
|
entity.setArticleTotalCount(0); |
|
|
|
entity.setArticlePublishedCount(0); |
|
|
|
entity.setPublishedCount(0); |
|
|
|
entity.setArticleTotalCount(NumConstant.ZERO); |
|
|
|
entity.setArticlePublishedCount(NumConstant.ZERO); |
|
|
|
entity.setPublishedCount(NumConstant.ZERO); |
|
|
|
result.put(dimGridEntity.getId(), entity); |
|
|
|
}); |
|
|
|
return result; |
|
|
@ -1075,9 +1053,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setCustomerId(dimGridEntity.getCustomerId()); |
|
|
|
entity.setPid(dimGridEntity.getPid()); |
|
|
|
entity.setAgencyId(dimGridEntity.getId()); |
|
|
|
entity.setArticleTotalCount(0); |
|
|
|
entity.setArticlePublishedCount(0); |
|
|
|
entity.setPublishedCount(0); |
|
|
|
entity.setArticleTotalCount(NumConstant.ZERO); |
|
|
|
entity.setArticlePublishedCount(NumConstant.ZERO); |
|
|
|
entity.setPublishedCount(NumConstant.ZERO); |
|
|
|
result.put(dimGridEntity.getId(), entity); |
|
|
|
}); |
|
|
|
return result; |
|
|
@ -1102,10 +1080,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setGridId(gridId); |
|
|
|
entity.setTagId(tagId); |
|
|
|
entity.setTagName(tagEntity.getTagName()); |
|
|
|
entity.setUsedCount(1); |
|
|
|
entity.setUsedCount(NumConstant.ONE); |
|
|
|
result.put(key, entity); |
|
|
|
} else { |
|
|
|
entity.setUsedCount(entity.getUsedCount() + 1); |
|
|
|
entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1121,10 +1099,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setDepartmentId(publisherId); |
|
|
|
entity.setTagId(tagId); |
|
|
|
entity.setTagName(tagEntity.getTagName()); |
|
|
|
entity.setUsedCount(1); |
|
|
|
entity.setUsedCount(NumConstant.ONE); |
|
|
|
result.put(key, entity); |
|
|
|
} else { |
|
|
|
entity.setUsedCount(entity.getUsedCount() + 1); |
|
|
|
entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1140,10 +1118,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agencyId); |
|
|
|
entity.setTagId(tagId); |
|
|
|
entity.setTagName(tagEntity.getTagName()); |
|
|
|
entity.setUsedCount(1); |
|
|
|
entity.setUsedCount(NumConstant.ONE); |
|
|
|
result.put(key, entity); |
|
|
|
} else { |
|
|
|
entity.setUsedCount(entity.getUsedCount() + 1); |
|
|
|
entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1159,10 +1137,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
entity.setAgencyId(agencyId); |
|
|
|
entity.setTagId(tagId); |
|
|
|
entity.setTagName(tagEntity.getTagName()); |
|
|
|
entity.setUsedCount(1); |
|
|
|
entity.setUsedCount(NumConstant.ONE); |
|
|
|
result.put(key, entity); |
|
|
|
} else { |
|
|
|
entity.setUsedCount(entity.getUsedCount() + 1); |
|
|
|
entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1171,7 +1149,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
String gridId = viewedSummaryDTO.getGridId(); |
|
|
|
String tagId = tagEntity.getTagId(); |
|
|
|
String key = gridId.concat(StrConstant.UNDER_LINE).concat(tagId); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); |
|
|
|
FactTagViewedGridDailyEntity entity = result.get(key); |
|
|
|
if (entity == null) { |
|
|
|
entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedGridDailyEntity.class); |
|
|
@ -1192,7 +1170,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
String agencyId = dimAgencyEntity.getId(); |
|
|
|
String tagId = tagEntity.getTagId(); |
|
|
|
String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); |
|
|
|
FactTagViewedAgencyDailyEntity entity = result.get(key); |
|
|
|
if (entity == null) { |
|
|
|
entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); |
|
|
@ -1213,7 +1191,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
String agencyId = dimAgencyEntity.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); |
|
|
|
String tagId = tagEntity.getTagId(); |
|
|
|
String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); |
|
|
|
Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); |
|
|
|
FactTagViewedAgencyDailyEntity entity = result.get(key); |
|
|
|
if (entity == null) { |
|
|
|
entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); |
|
|
|