Browse Source

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

dev_shibei_match
wangchao 5 years ago
parent
commit
cbd9f3d0e2
  1. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java
  2. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java
  3. 56
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java
  4. 85
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  7. 142
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  8. 59
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java
  9. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml
  11. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml
  12. 57
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml

36
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java

@ -46,6 +46,8 @@ public class PublicityServiceImpl implements PublicityService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @param tokenDto
* @Description 宣传能力工作端当前机关累计发文和当前发文
@ -66,16 +68,16 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactTagViewedAgencyDTO> tagviewed(TokenDto tokenDto, Integer pageSize, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN);
Date dateFact = DateUtils.addDateDays( new Date(),-1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(0, 6);
if (StringUtils.equals("month", type)) {//当月
String monthId = strDate.substring(0, 4) + strDate.substring(5, 7);
return publicityDao.getViewedMonthlyCountByTag(agencyId, monthId, pageSize);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getViewedQuarterlyCountByTag(agencyId, quarterId, pageSize);
} else if (StringUtils.equals("year", type)) {//当年
@ -94,16 +96,16 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactTagUsedAgencyDTO> tagused(TokenDto tokenDto, Integer pageSize, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN);
Date dateFact = DateUtils.addDateDays( new Date(),-1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(0, 6);
if (StringUtils.equals("month", type)) {//当月
String monthId = strDate.substring(0, 4) + strDate.substring(5, 7);
return publicityDao.getUsedMonthlyCountByTag(agencyId, monthId, pageSize);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getUsedQuarterlyCountByTag(agencyId, quarterId, pageSize);
} else if (StringUtils.equals("year", type)) {//当年
@ -122,8 +124,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedAgencyDTO> subagencyPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
Date dateFact = DateUtils.addDateDays( new Date(),-1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(0, 6);
@ -131,7 +133,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubAgencyPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubAgencyPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年
@ -150,8 +152,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedDepartmentDTO> departmentPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
Date dateFact = DateUtils.addDateDays( new Date(),-1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(0, 6);
@ -159,7 +161,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubDepartPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubDepartPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年
@ -178,8 +180,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedGridDTO> subgridPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
Date dateFact = DateUtils.addDateDays( new Date(),-1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(0, 6);
@ -187,7 +189,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubGridPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubGridPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年

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

@ -289,8 +289,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService {
break;
}
}
logger.info(String.format("找到当前网格(gridId=%s,gridName=%s)对应的数据,当前循环",dimInitResultDto.getGridId(),dimInitResultDto.getName()));
break;
logger.debug(String.format("找到当前网格(gridId=%s,gridName=%s)对应的数据,当前循环",dimInitResultDto.getGridId(),dimInitResultDto.getName()));
}
if(!flag){
logger.error(String.format("直属网格注册用户数缺少记录:date_id=%s,gridId=%s",formDTO.getDateId(),dimInitResultDto.getGridId()));

56
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java

@ -1,56 +0,0 @@
/**
* 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.dto.voice.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticlePublishRangeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Mapper
public interface ArticlePublishRangeDao extends BaseDao<ArticlePublishRangeEntity> {
/**
* desc:查询网格发布文章总数及状态为发布中的文章总数
*
* @param customerId
* @param createDate
* @return
*/
List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(@Param("customerId") String customerId, @Param("createDate") Date createDate);
/**
* desc: 根据客户Id创建日期查询某一天的 文章发布数据
*
* @param customerId
* @param startDate
* @param endDate
* @return: List<ArticleGridPublishedSummaryDTO>
*/
List<ArticleGridPublishedSummaryDTO> getOneDayPublishedCount(@Param("customerId") String customerId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}

85
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java

@ -1,85 +0,0 @@
/**
* 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;
import java.util.Date;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("article_publish_range")
public class ArticlePublishRangeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 文章ID
*/
private String articleId;
/**
* 网格ID
*/
private String gridId;
/**
* 组织-网格名称
*/
private String agencyGridName;
/**
* 组织ID
*/
private String agencyId;
/**
* 所有上级组织机构ID 以英文:隔开
*/
private String pids;
/**
* 所有上级名称 以横杠隔开
*/
private String allParentName;
/**
* 下线时间
*/
private Date offLineTime;
/**
* 发布状态 已发布:published;已下线offline
*/
private String publishStatus;
}

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

@ -154,7 +154,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
//机关下的所有网格(包括直属网格)
List<String> allGrid = this.getAllGrid(agencyId,customerId);
if (allGrid.size() != NumConstant.ZERO) {
// 1. 机关下有多少网格
// 1. 机关下有多少网格 (this.getAllGrid拿的是当前机关下所有网格,以下方法是根据“dateId”来拿的,两者过滤)
List<GridIdListByCustomerResultDTO> customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId);
AtomicReference<Integer> gridSize = new AtomicReference<>(NumConstant.ZERO);
if (customerGridIdList.size() != NumConstant.ZERO) {

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -227,6 +227,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
FactIssueAgencyMonthlyDTO dto = issueAgencyMonthlyIncList.get(i);
if (agency.getId().equals(dto.getAgencyId())) {
monthly.setIssueIncr(dto.getIssueIncr());
monthly.setVotingIncr(dto.getVotingIncr());
monthly.setShiftProjectIncr(dto.getShiftProjectIncr());
monthly.setClosedIncr(dto.getClosedIncr());
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr());
@ -430,6 +431,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
FactIssueGridMonthlyDTO dto = gridMonthlyIncListList.get(i);
if (grid.getId().equals(dto.getGridId())) {
monthly.setIssueIncr(dto.getIssueIncr());
monthly.setVotingIncr(dto.getVotingIncr());
monthly.setShiftProjectIncr(dto.getShiftProjectIncr());
monthly.setClosedIncr(dto.getClosedIncr());
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr());

142
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java

@ -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);

59
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java

@ -1,59 +0,0 @@
/**
* 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.dto.voice.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticlePublishRangeEntity;
import java.util.Date;
import java.util.List;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
public interface ArticlePublishRangeService extends BaseService<ArticlePublishRangeEntity> {
/**
* desc: 根据客户Id 创建日期查询 有史以来所有的发布文章总数
*
* @param customerId
* @param createDate
* @return: List<ArticleGridPublishedSummaryDTO>
* @date: 2020/6/17 16:59
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(String customerId, Date createDate);
/**
* desc: 根据客户Id创建日期查询某一天的 文章发布数据
*
* @param customerId
* @param startDate
* @param endDate
* @return: List<ArticleGridPublishedSummaryDTO>
* @date: 2020/6/17 21:43
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
List<ArticleGridPublishedSummaryDTO> getOneDayPublishedCount(String customerId, Date startDate, Date endDate);
}

67
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java

@ -1,67 +0,0 @@
/**
* 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.ArticlePublishRangeDao;
import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticlePublishRangeEntity;
import com.epmet.service.voice.ArticlePublishRangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.GOV_VOICE)
public class ArticlePublishRangeServiceImpl extends BaseServiceImpl<ArticlePublishRangeDao, ArticlePublishRangeEntity> implements ArticlePublishRangeService {
@Override
public List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(String customerId, Date createDate) {
log.debug("getAllPublishedCount param customerId:{},createDate:{}", customerId, createDate);
return baseDao.getAllPublishedCount(customerId, createDate);
}
/**
* desc: 根据客户Id创建日期查询某一天的 文章发布数据
*
* @param customerId
* @param startDate
* @param endDate
* @return: List<ArticleGridPublishedSummaryDTO>
* @date: 2020/6/17 21:43
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
@Override
public List<ArticleGridPublishedSummaryDTO> getOneDayPublishedCount(String customerId, Date startDate, Date endDate) {
log.debug("getOneDayPublishedCount param startDate:{},endDate:{}", startDate, endDate);
return baseDao.getOneDayPublishedCount(customerId, startDate, endDate);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml

@ -51,6 +51,7 @@
SELECT
da.ID AS "agencyId",
SUM(IFNULL(ISSUE_INCR, 0)) AS "issueIncr",
SUM(IFNULL(VOTING_INCR, 0)) AS "votingIncr",
SUM(IFNULL(SHIFT_PROJECT_INCR, 0)) AS "shiftProjectIncr",
SUM(IFNULL(CLOSED_INCR, 0)) AS "closedIncr",
SUM(IFNULL(CLOSED_RESOLVED_INCR, 0)) AS "closedResolvedIncr",
@ -64,6 +65,7 @@
AND MONTH_ID = #{monthId}
WHERE
da.DEL_FLAG = '0'
AND da.AGENCY_DIM_TYPE= 'all'
AND da.CUSTOMER_ID = #{customerId}
GROUP BY
da.ID

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml

@ -57,6 +57,7 @@
dg.AGENCY_ID AS "agencyId",
dg.ID AS "gridId",
SUM(IFNULL(ISSUE_INCR, 0)) AS "issueIncr",
SUM(IFNULL(VOTING_INCR, 0)) AS "votingIncr",
SUM(IFNULL(SHIFT_PROJECT_INCR, 0)) AS "shiftProjectIncr",
SUM(IFNULL(CLOSED_INCR, 0)) AS "closedIncr",
SUM(IFNULL(CLOSED_RESOLVED_INCR, 0)) AS "closedResolvedIncr",

57
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml

@ -1,57 +0,0 @@
<?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.ArticlePublishRangeDao">
<resultMap type="com.epmet.entity.voice.ArticlePublishRangeEntity" id="articlePublishRangeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="articleId" column="ARTICLE_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyGridName" column="AGENCY_GRID_NAME"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="allParentName" column="ALL_PARENT_NAME"/>
<result property="offLineTime" column="OFF_LINE_TIME"/>
<result property="publishStatus" column="PUBLISH_STATUS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getAllPublishedCount" resultType="com.epmet.dto.voice.ArticleGridPublishedSummaryDTO">
SELECT
AGENCY_ID,
GRID_ID,
count(ID) articleTotalCount,
sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) articlePublishedCount
FROM
article_publish_range
WHERE
DEL_FLAG = 0 AND
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND
CREATED_TIME <![CDATA[ <#{createDate,jdbcType=TIMESTAMP}]]>
GROUP BY
CUSTOMER_ID,
GRID_ID
</select>
<select id="getOneDayPublishedCount" resultType="com.epmet.dto.voice.ArticleGridPublishedSummaryDTO">
SELECT
GRID_ID,
count(ID) publishedCount,
sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) publishingCount
FROM
article_publish_range
WHERE
DEL_FLAG = 0 AND
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND
CREATED_TIME BETWEEN #{startDate,jdbcType=TIMESTAMP} AND #{endDate,jdbcType=TIMESTAMP}
GROUP BY
CUSTOMER_ID,
GRID_ID
</select>
</mapper>
Loading…
Cancel
Save