Browse Source

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

master
yinzuomei 5 years ago
parent
commit
9af6b2ce97
  1. 40
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/voice/ArticleViewedSummaryDTO.java
  2. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagUsedAgencyMonthlyDao.java
  4. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyDailyDao.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyMonthlyDao.java
  6. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyQuarterlyDao.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyYearlyDao.java
  8. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridDailyDao.java
  9. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridMonthlyDao.java
  10. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridQuarterlyDao.java
  11. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridYearlyDao.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleTagsDao.java
  13. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleVisitRecordDao.java
  14. 58
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleVisitRecordEntity.java
  15. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java
  16. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  17. 358
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  18. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedAgencyMonthlyService.java
  19. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedAgencyYearlyService.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedDepartmentYearlyService.java
  21. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedGridYearlyService.java
  22. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyDailyService.java
  23. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyMonthlyService.java
  24. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyQuarterlyService.java
  25. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyYearlyService.java
  26. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridDailyService.java
  27. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridMonthlyService.java
  28. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridQuarterlyService.java
  29. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridYearlyService.java
  30. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedAgencyMonthlyServiceImpl.java
  31. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedAgencyYearlyServiceImpl.java
  32. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedDepartmentYearlyServiceImpl.java
  33. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedGridYearlyServiceImpl.java
  34. 62
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyDailyServiceImpl.java
  35. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyMonthlyServiceImpl.java
  36. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyQuarterlyServiceImpl.java
  37. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyYearlyServiceImpl.java
  38. 64
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridDailyServiceImpl.java
  39. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridMonthlyServiceImpl.java
  40. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridQuarterlyServiceImpl.java
  41. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridYearlyServiceImpl.java
  42. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleTagsService.java
  43. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleVisitRecordService.java
  44. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleTagsServiceImpl.java
  45. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleVisitRecordServiceImpl.java
  46. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml
  47. 45
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml
  48. 62
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml
  49. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyQuarterlyDao.xml
  50. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyYearlyDao.xml
  51. 25
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml
  52. 47
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml
  53. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridQuarterlyDao.xml
  54. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridYearlyDao.xml
  55. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleTagsDao.xml
  56. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleVisitRecordDao.xml

40
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/voice/ArticleViewedSummaryDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.voice;
/**
* @author jianjun liu
* @email liujianjun@yunzongnet.com
* @date 2020-06-17 16:43
**/
import lombok.Data;
import java.io.Serializable;
/**
* desc文章总数 统计返回结果 dto
*
* @author liujianjun
* @date 2020/6/17 16:43
*/
@Data
public class ArticleViewedSummaryDTO implements Serializable {
private static final long serialVersionUID = -6430902856772516776L;
/**
* 客户id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 文章Id
*/
private String articleId;
/**
* 该篇文章被阅读的次数和
*/
private Integer viewedCount;
}

24
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java

@ -24,7 +24,7 @@ public class StatsPublicityController {
private ExecutorService executorService;
/**
* desc:统计文章总数及在线文章总数
* desc:统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @param statsDate 默认为T-1天如果传 则统计的是statsDate的数据
* @return
@ -55,4 +55,26 @@ public class StatsPublicityController {
public Result<Boolean> tagUsedMonthStatsjob(Date statsDate) {
return new Result<Boolean>().ok(statsPublicityService.tagUsedMonthStatsjob(statsDate));
}
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @param statsDate 默认为T-1天如果传 则统计的是statsDate的数据
* @return
*/
@PostMapping(value = "tagViewedDayStatsjob")
public Result<Boolean> tagViewedDayStatsjob(Date statsDate) {
return new Result<Boolean>().ok(statsPublicityService.tagViewedDayStatsjob(statsDate));
}
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @param statsDate 默认为T-1天如果传 则统计的是statsDate的数据
* @return
*/
@PostMapping(value = "tagViewedMonthStatsjob")
public Result<Boolean> tagViewedMonthStatsjob(Date statsDate) {
return new Result<Boolean>().ok(statsPublicityService.tagViewedMonthStatsjob(statsDate));
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagUsedAgencyMonthlyDao.java

@ -19,7 +19,6 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagUsedAgencyMonthlyEntity;
import com.epmet.entity.stats.FactTagUsedGridMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -34,9 +33,9 @@ import java.util.List;
@Mapper
public interface FactTagUsedAgencyMonthlyDao extends BaseDao<FactTagUsedAgencyMonthlyEntity> {
List<FactTagUsedGridMonthlyEntity> getTagUsedCountByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
List<FactTagUsedGridMonthlyEntity> getTagUsedCountByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyDailyDao.java

@ -20,6 +20,9 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedAgencyDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章引用标签阅读数量机关日统计表
@ -29,5 +32,8 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedAgencyDailyDao extends BaseDao<FactTagViewedAgencyDailyEntity> {
int deleteByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<FactTagViewedAgencyDailyEntity> getTagViewedCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyMonthlyDao.java

@ -20,6 +20,9 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章引用标签阅读数量机关月统计表
@ -29,5 +32,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedAgencyMonthlyDao extends BaseDao<FactTagViewedAgencyMonthlyEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<FactTagViewedAgencyMonthlyEntity> getTagViewedCountByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
List<FactTagViewedAgencyMonthlyEntity> getTagUsedCountByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyQuarterlyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedAgencyQuarterlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 文章引用标签阅读数量机关季度统计表
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedAgencyQuarterlyDao extends BaseDao<FactTagViewedAgencyQuarterlyEntity> {
int deleteByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedAgencyYearlyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedAgencyYearlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 文章引用标签阅读数量机关年度统计表
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedAgencyYearlyDao extends BaseDao<FactTagViewedAgencyYearlyEntity> {
int deleteByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridDailyDao.java

@ -20,6 +20,9 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedGridDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章引用标签阅读数量网格日统计表
@ -29,5 +32,8 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedGridDailyDao extends BaseDao<FactTagViewedGridDailyEntity> {
int deleteByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<FactTagViewedGridDailyEntity> getTagViewedCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridMonthlyDao.java

@ -20,6 +20,9 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedGridMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章引用标签阅读数量网格月统计表
@ -29,5 +32,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedGridMonthlyDao extends BaseDao<FactTagViewedGridMonthlyEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<FactTagViewedGridMonthlyEntity> getTagViewCountByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
List<FactTagViewedGridMonthlyEntity> getTagUsedCountByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridQuarterlyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedGridQuarterlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 文章引用标签阅读数量网格季度统计表
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedGridQuarterlyDao extends BaseDao<FactTagViewedGridQuarterlyEntity> {
int deleteByQuarterId(@Param("customerId") String customerId, @Param("quarterId") String quarterId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTagViewedGridYearlyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactTagViewedGridYearlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 文章引用标签阅读数量网格年度统计表
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactTagViewedGridYearlyDao extends BaseDao<FactTagViewedGridYearlyEntity> {
int deleteByYearId(@Param("customerId") String customerId, @Param("yearId") String yearId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleTagsDao.java

@ -43,4 +43,6 @@ public interface ArticleTagsDao extends BaseDao<ArticleTagsEntity> {
* @return
*/
List<ArticleTagsEntity> getArticleTagsByDay(@Param("customerId") String customerId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
List<ArticleTagsEntity> getArticleTagsByArticleId(@Param("customerId") String customerId, @Param("articleId") String articleId);
}

39
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleVisitRecordDao.java

@ -0,0 +1,39 @@
/**
* 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.ArticleViewedSummaryDTO;
import com.epmet.entity.voice.ArticleVisitRecordEntity;
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 ArticleVisitRecordDao extends BaseDao<ArticleVisitRecordEntity> {
List<ArticleViewedSummaryDTO> getArticleVisitByCreateTime(@Param("customerId") String customerId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

58
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleVisitRecordEntity.java

@ -0,0 +1,58 @@
/**
* 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-17
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("article_visit_record")
public class ArticleVisitRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 网格ID
*/
private String gridId;
/**
* 文章ID
*/
private String articleId;
/**
* 用户ID
*/
private String userId;
}

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java

@ -35,4 +35,25 @@ public interface StatsPublicityService {
*/
Boolean tagUsedMonthStatsjob(Date statsDate);
/**
* desc: 按日 统计每个标签的阅读数
*
* @param statsDate
* @return: Boolean
* @date: 2020/6/20 8:40
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
Boolean tagViewedDayStatsjob(Date statsDate);
/**
* desc:
*
* @param statsDate
* @return:
* @date: 2020/6/20 10:44
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
Boolean tagViewedMonthStatsjob(Date statsDate);
}

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

@ -72,7 +72,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
customerStats(customerId);
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize);
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
}
/**

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

@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO;
import com.epmet.dto.voice.ArticleViewedSummaryDTO;
import com.epmet.entity.stats.*;
import com.epmet.entity.voice.ArticleEntity;
import com.epmet.entity.voice.ArticleTagsEntity;
@ -15,6 +16,7 @@ import com.epmet.service.stats.*;
import com.epmet.service.voice.ArticlePublishRangeService;
import com.epmet.service.voice.ArticleService;
import com.epmet.service.voice.ArticleTagsService;
import com.epmet.service.voice.ArticleVisitRecordService;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -64,6 +66,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
@Autowired
private ArticlePublishRangeService articlePublishRangeService;
@Autowired
private ArticleVisitRecordService articleVisitRecordService;
@Autowired
private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService;
@Autowired
private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService;
@ -94,6 +98,22 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
@Autowired
private FactTagUsedAgencyYearlyService factTagUsedAgencyYearlyService;
@Autowired
private FactTagViewedGridDailyService factTagViewedGridDailyService;
@Autowired
private FactTagViewedAgencyDailyService factTagViewedAgencyDailyService;
@Autowired
private FactTagViewedGridMonthlyService factTagViewedGridMonthlyService;
@Autowired
private FactTagViewedAgencyMonthlyService factTagViewedAgencyMonthlyService;
@Autowired
private FactTagViewedGridQuarterlyService factTagViewedGridQuarterlyService;
@Autowired
private FactTagViewedAgencyQuarterlyService factTagViewedAgencyQuarterlyService;
@Autowired
private FactTagViewedGridYearlyService factTagViewedGridYearlyService;
@Autowired
private FactTagViewedAgencyYearlyService factTagViewedAgencyYearlyService;
@Autowired
private ExecutorService executorService;
@Override
@ -127,7 +147,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
});
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize);
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
return true;
}
@ -151,14 +171,12 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
for (String customerId : customerIdList) {
Date finalStatsDate = statsDate;
executorService.submit(() -> {
//key:所在机关Id
Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap = new HashMap<>();
//统计
statsTagUsedDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap);
statsTagUsedDaily(finalStatsDate, dimIdBean, customerId);
});
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize);
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
return true;
}
@ -183,21 +201,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
executorService.submit(() -> {
try {
statsTagUsedMonthly(dimIdBean.getMonthId(), customerId);
//statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId);
//statsTagUsedYearly(dimIdBean.getYearId(), customerId);
countDownLatch.countDown();
} catch (Exception e) {
log.error("statsTagUsedMonthly exception", e);
}
});
log.debug("start === statsTagUsedQuarterly ");
try {
countDownLatch.await();
} catch (InterruptedException e) {
log.error("countDownLatch.await() interrupted", e);
}
executorService.submit(() -> {
try {
countDownLatch.await();
log.debug("start === statsTagUsedQuarterly ");
statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId);
} catch (Exception e) {
@ -206,6 +217,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
});
executorService.submit(() -> {
try {
countDownLatch.await();
log.debug("start === statsTagUsedQuarterly ");
statsTagUsedYearly(dimIdBean.getYearId(), customerId);
} catch (Exception e) {
@ -214,7 +226,90 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
});
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize);
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
return true;
}
@Override
public Boolean tagViewedDayStatsjob(Date statsDate) {
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
if (statsDate == null) {
//当天的凌晨时间 即为今天之前的数据
statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN);
} else {
statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN);
}
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
int pageNo = 1;
int pageSize = 100;
List<String> customerIdList = null;
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) {
Date finalStatsDate = statsDate;
//executorService.submit(() -> {
//统计
statsTagViewedDaily(finalStatsDate, dimIdBean, customerId);
//});
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
return true;
}
@Override
public Boolean tagViewedMonthStatsjob(Date statsDate) {
//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
if (statsDate == null) {
//当天的凌晨时间 即为今天之前的数据
statsDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
} else {
statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN);
}
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
int pageNo = 1;
int pageSize = 100;
List<String> customerIdList = null;
CountDownLatch countDownLatch = new CountDownLatch(1);
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) {
if (!"6c8cfc2c14afeb6d3664b3e283fc9074".equals(customerId)) {
continue;
}
executorService.submit(() -> {
try {
statsTagViewedMonthly(dimIdBean.getMonthId(), customerId);
countDownLatch.countDown();
} catch (Exception e) {
log.error("statsTagViewedMonthly exception", e);
}
});
executorService.submit(() -> {
try {
countDownLatch.await();
log.debug("start === statsTagViewedQuarterly ");
statsTagViewedQuarterly(dimIdBean.getQuarterId(), customerId);
} catch (Exception e) {
log.error("statsTagUsedQuarterly exception", e);
}
});
executorService.submit(() -> {
try {
countDownLatch.await();
log.debug("start === statsTagViewedYearly ");
statsTagViewedYearly(dimIdBean.getYearId(), customerId);
} catch (Exception e) {
log.error("statsTagUsedYearly exception", e);
}
});
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
return true;
}
@ -357,9 +452,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
* @param statsDate
* @param dimIdBean
* @param customerId
* @param agencySummaryMap
*/
private void statsTagUsedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap) {
private void statsTagUsedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) {
//1.业务数据来源 发布时间为统计时间的
// 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分
// 1.1查出今天所有的文章标签 根据网格Id
@ -409,7 +503,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean);
break;
}
convertTagUsedGridDailyEntity(tagUsedGridDailyMap, articleEntity, tagEntity, dimIdBean);
}
factTagUsedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedGridDailyMap.values());
@ -430,6 +523,82 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
factTagUsedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values());
}
/**
* desc:按日统计 标签被阅读的次数
*
* @param statsDate
* @param dimIdBean
* @param customerId
*/
private void statsTagViewedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) {
//1.业务数据来源 发布时间为统计时间的
// 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分
// 1.1查出今天所有的文章标签 根据网格Id
// 1.2
//获取所有机关 用于后面想上级添加数据
List<DimAgencyEntity> agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId);
if (CollectionUtils.isEmpty(agencyDTOList)) {
log.debug("statsTagViewedDaily customerId:{} have any agency", customerId);
return;
}
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<>();
//获取当天的业务数据
//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;
}
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());
articleTagsList.forEach(articleTag -> {
convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean);
convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean);
});
}
factTagViewedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagViewedGridDailyMap.values());
//向上级机关递归添加 数据
Map<String, FactTagViewedAgencyDailyEntity> finalTagUsedAgencyDailyMap = new HashMap<>();
finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailyMap);
for (Map.Entry<String, FactTagViewedAgencyDailyEntity> entry : tagViewedAgencyDailyMap.entrySet()) {
String agencyId = entry.getKey();
FactTagViewedAgencyDailyEntity currentEntity = entry.getValue();
DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(currentEntity.getAgencyId());
if (dimAgencyEntity == null) {
log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", agencyId);
continue;
}
setTagViewedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, currentEntity, dimIdBean);
}
factTagViewedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values());
}
/**
* desc:按月统计 标签使用数
*
@ -440,17 +609,37 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
List<FactTagUsedGridDailyEntity> gridDailyList = factTagUsedGridDailyService.getTagUsedCountByMonth(customerId, monthId);
if (!CollectionUtils.isEmpty(gridDailyList)) {
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = ConvertUtils.sourceToTarget(gridDailyList, FactTagUsedGridMonthlyEntity.class);
factTagUsedGridMonthlyService.deleteAndInsertByMonthId(customerId,monthId,gridMonthlyList);
factTagUsedGridMonthlyService.deleteAndInsertByMonthId(customerId, monthId, gridMonthlyList);
}
List<FactTagUsedDepartmentDailyEntity> deptDailyList = factTagUsedDepartmentDailyService.getTagUsedCountByMonth(customerId, monthId);
if (!CollectionUtils.isEmpty(deptDailyList)) {
List<FactTagUsedDepartmentMonthlyEntity> gridMonthlyList = ConvertUtils.sourceToTarget(deptDailyList, FactTagUsedDepartmentMonthlyEntity.class);
factTagUsedDepartmentMonthlyService.deleteAndInsertByMonthId(customerId,monthId,gridMonthlyList);
factTagUsedDepartmentMonthlyService.deleteAndInsertByMonthId(customerId, monthId, gridMonthlyList);
}
List<FactTagUsedGridDailyEntity> agencyDailyList = factTagUsedAgencyDailyService.getTagUsedCountByMonth(customerId, monthId);
if (!CollectionUtils.isEmpty(agencyDailyList)) {
List<FactTagUsedAgencyMonthlyEntity> agencyMonthlyList = ConvertUtils.sourceToTarget(agencyDailyList, FactTagUsedAgencyMonthlyEntity.class);
factTagUsedAgencyMonthlyService.deleteAndInsertByMonthId(customerId,monthId,(agencyMonthlyList));
factTagUsedAgencyMonthlyService.deleteAndInsertByMonthId(customerId, monthId, (agencyMonthlyList));
}
}
/**
* desc:按月统计 标签使用数
*
* @param monthId
* @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);
factTagViewedGridMonthlyService.deleteAndInsertByMonthId(customerId, monthId, gridMonthlyList);
}
List<FactTagViewedAgencyDailyEntity> agencyDailyList = factTagViewedAgencyDailyService.getTagViewedCountByMonth(customerId, monthId);
if (!CollectionUtils.isEmpty(agencyDailyList)) {
List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList = ConvertUtils.sourceToTarget(agencyDailyList, FactTagViewedAgencyMonthlyEntity.class);
factTagViewedAgencyMonthlyService.deleteAndInsertByMonthId(customerId, monthId, (agencyMonthlyList));
}
}
@ -464,18 +653,37 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId);
if (!CollectionUtils.isEmpty(gridMonthlyList)) {
List<FactTagUsedGridQuarterlyEntity> gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridQuarterlyEntity.class);
factTagUsedGridQuarterlyService.deleteAndInsertByQuarterId(customerId,quarterId,gridQuarterlyList);
factTagUsedGridQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, gridQuarterlyList);
}
List<FactTagUsedDepartmentMonthlyEntity> deptMonthlyList = factTagUsedDepartmentMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId);
if (!CollectionUtils.isEmpty(deptMonthlyList)) {
List<FactTagUsedDepartmentQuarterlyEntity> deptQuarterlyList = ConvertUtils.sourceToTarget(deptMonthlyList, FactTagUsedDepartmentQuarterlyEntity.class);
factTagUsedDepartmentQuarterlyService.deleteAndInsertByQuarterId(customerId,quarterId,deptQuarterlyList);
factTagUsedDepartmentQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, deptQuarterlyList);
}
//TODO 机关的需要添加 pid
List<FactTagUsedGridMonthlyEntity> agencyMonthlyList = factTagUsedAgencyMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId);
List<FactTagUsedAgencyMonthlyEntity> agencyMonthlyList = factTagUsedAgencyMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId);
if (!CollectionUtils.isEmpty(agencyMonthlyList)) {
List<FactTagUsedAgencyQuarterlyEntity> agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyQuarterlyEntity.class);
factTagUsedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId,agencyQuarterlyList);
factTagUsedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, agencyQuarterlyList);
}
}
/**
* desc:按季统计 标签查看数
*
* @param quarterId
* @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);
}
}
@ -489,21 +697,36 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByYearId(customerId, yearId);
if (!CollectionUtils.isEmpty(gridMonthlyList)) {
List<FactTagUsedGridYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridYearlyEntity.class);
//TODO 改为一个方法 添加事务
factTagUsedGridYearlyService.deleteByYearId(customerId, yearId);
factTagUsedGridYearlyService.insertBatch(gridYearlyList);
factTagUsedGridYearlyService.deleteAndInsertByYearId(customerId, yearId, gridYearlyList);
}
List<FactTagUsedDepartmentMonthlyEntity> deptMonthlyList = factTagUsedDepartmentMonthlyService.getTagUsedCountByYearId(customerId, yearId);
if (!CollectionUtils.isEmpty(deptMonthlyList)) {
List<FactTagUsedDepartmentYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(deptMonthlyList, FactTagUsedDepartmentYearlyEntity.class);
factTagUsedDepartmentYearlyService.deleteByYearId(customerId, yearId);
factTagUsedDepartmentYearlyService.insertBatch(gridYearlyList);
factTagUsedDepartmentYearlyService.deleteAndInsertByYearId(customerId, yearId, gridYearlyList);
}
List<FactTagUsedGridMonthlyEntity> agencyMonthlyList = factTagUsedAgencyMonthlyService.getTagUsedCountByYearId(customerId, yearId);
List<FactTagUsedAgencyMonthlyEntity> agencyMonthlyList = factTagUsedAgencyMonthlyService.getTagUsedCountByYearId(customerId, yearId);
if (!CollectionUtils.isEmpty(agencyMonthlyList)) {
List<FactTagUsedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyYearlyEntity.class);
factTagUsedAgencyYearlyService.deleteByYearId(customerId, yearId);
factTagUsedAgencyYearlyService.insertBatch(agencyYearlyList);
factTagUsedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList);
}
}
/**
* desc:按年统计 标签阅读数
*
* @param yearId
* @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);
factTagViewedGridYearlyService.deleteAndInsertByYearId(customerId, yearId, gridYearlyList);
}
List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList = factTagViewedAgencyMonthlyService.getTagViewedCountByYearId(customerId, yearId);
if (!CollectionUtils.isEmpty(agencyMonthlyList)) {
List<FactTagViewedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyYearlyEntity.class);
factTagViewedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList);
}
}
@ -534,6 +757,33 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
}
}
private void setTagViewedData2ParentAgency(Map<String, DimAgencyEntity> dimAgencyEntityMap, Map<String, FactTagViewedAgencyDailyEntity> agencyDailyEntityMap, FactTagViewedAgencyDailyEntity currentEntity, DimIdGenerator.DimIdBean dimIdBean) {
String pid = currentEntity.getPid();
String tagId = currentEntity.getTagId();
String key = pid.concat(StrConstant.UNDER_LINE).concat(tagId);
FactTagViewedAgencyDailyEntity parentAgencyDailyEntity = agencyDailyEntityMap.get(key);
DimAgencyEntity currentDimAgency = dimAgencyEntityMap.get(pid);
if (currentDimAgency == null) {
return;
}
if (parentAgencyDailyEntity == null) {
parentAgencyDailyEntity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class);
parentAgencyDailyEntity.setCustomerId(currentEntity.getCustomerId());
parentAgencyDailyEntity.setPid(currentDimAgency.getPid());
parentAgencyDailyEntity.setAgencyId(currentDimAgency.getId());
parentAgencyDailyEntity.setTagId(currentEntity.getTagId());
parentAgencyDailyEntity.setTagName(currentEntity.getTagName());
parentAgencyDailyEntity.setTagReadCount(currentEntity.getTagReadCount());
agencyDailyEntityMap.put(key, parentAgencyDailyEntity);
} else {
parentAgencyDailyEntity.setTagReadCount(parentAgencyDailyEntity.getTagReadCount() + currentEntity.getTagReadCount());
}
pid = currentDimAgency.getPid();
if (!NumConstant.ZERO_STR.equals(pid)) {
setTagViewedData2ParentAgency(dimAgencyEntityMap, agencyDailyEntityMap, parentAgencyDailyEntity, dimIdBean);
}
}
private void setPublishedData2ParentAgency(Map<String, FactArticlePublishedAgencyDailyEntity> agencyDailyEntityMap, FactArticlePublishedAgencyDailyEntity agencySummary, FactArticlePublishedAgencyDailyEntity summary) {
String pid = summary.getPid();
FactArticlePublishedAgencyDailyEntity parentAgency = agencyDailyEntityMap.get(pid);
@ -690,4 +940,46 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
entity.setUsedCount(entity.getUsedCount() + 1);
}
}
private void convertTagViewedGridDailyEntity(DimAgencyEntity dimAgencyEntity, Map<String, FactTagViewedGridDailyEntity> result,
ArticleTagsEntity tagEntity, ArticleViewedSummaryDTO viewedSummaryDTO, DimIdGenerator.DimIdBean dimIdBean) {
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();
FactTagViewedGridDailyEntity entity = result.get(key);
if (entity == null) {
entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedGridDailyEntity.class);
entity.setGridId(gridId);
entity.setCustomerId(tagEntity.getCustomerId());
entity.setAgencyId(dimAgencyEntity.getId());
entity.setTagId(tagId);
entity.setTagName(tagEntity.getTagName());
entity.setTagReadCount(viewedCount);
result.put(key, entity);
} else {
entity.setTagReadCount(entity.getTagReadCount() + viewedCount);
}
}
private void convertTagViewedAgencyDailyEntity(DimAgencyEntity dimAgencyEntity, Map<String, FactTagViewedAgencyDailyEntity> result,
ArticleTagsEntity tagEntity, ArticleViewedSummaryDTO viewedSummaryDTO, DimIdGenerator.DimIdBean dimIdBean) {
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();
FactTagViewedAgencyDailyEntity entity = result.get(key);
if (entity == null) {
entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class);
entity.setPid(dimAgencyEntity.getPid());
entity.setCustomerId(tagEntity.getCustomerId());
entity.setAgencyId(agencyId);
entity.setTagId(tagId);
entity.setTagName(tagEntity.getTagName());
entity.setTagReadCount(viewedCount);
result.put(key, entity);
} else {
entity.setTagReadCount(entity.getTagReadCount() + viewedCount);
}
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedAgencyMonthlyService.java

@ -19,7 +19,6 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagUsedAgencyMonthlyEntity;
import com.epmet.entity.stats.FactTagUsedGridMonthlyEntity;
import java.util.List;
@ -31,9 +30,9 @@ import java.util.List;
*/
public interface FactTagUsedAgencyMonthlyService extends BaseService<FactTagUsedAgencyMonthlyEntity> {
List<FactTagUsedGridMonthlyEntity> getTagUsedCountByYearId(String customerId, String monthId);
List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByYearId(String customerId, String monthId);
List<FactTagUsedGridMonthlyEntity> getTagUsedCountByQuarterId(String customerId, String quarterId);
List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByQuarterId(String customerId, String quarterId);
Boolean deleteAndInsertByMonthId(String customerId, String monthId, List<FactTagUsedAgencyMonthlyEntity> agencyMonthlyList);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedAgencyYearlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagUsedAgencyYearlyEntity;
import java.util.List;
/**
* 标签机关年度统计表
*
@ -28,6 +30,7 @@ import com.epmet.entity.stats.FactTagUsedAgencyYearlyEntity;
*/
public interface FactTagUsedAgencyYearlyService extends BaseService<FactTagUsedAgencyYearlyEntity> {
int deleteByYearId(String customerId,String yearId);
int deleteByYearId(String customerId, String yearId);
Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedAgencyYearlyEntity> agencyYearlyList);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedDepartmentYearlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagUsedDepartmentYearlyEntity;
import java.util.List;
/**
* 标签部门年度统计表
*
@ -29,5 +31,5 @@ import com.epmet.entity.stats.FactTagUsedDepartmentYearlyEntity;
public interface FactTagUsedDepartmentYearlyService extends BaseService<FactTagUsedDepartmentYearlyEntity> {
Integer deleteByYearId(String customerId, String yearId);
Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedDepartmentYearlyEntity> gridYearlyList);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagUsedGridYearlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagUsedGridYearlyEntity;
import java.util.List;
/**
* 标签网格年度统计表
*
@ -27,6 +29,5 @@ import com.epmet.entity.stats.FactTagUsedGridYearlyEntity;
* @since v1.0.0 2020-06-18
*/
public interface FactTagUsedGridYearlyService extends BaseService<FactTagUsedGridYearlyEntity> {
Integer deleteByYearId(String customerId, String yearId);
Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedGridYearlyEntity> gridYearlyList);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyDailyService.java

@ -20,6 +20,9 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedAgencyDailyEntity;
import java.util.Collection;
import java.util.List;
/**
* 文章引用标签阅读数量机关日统计表
*
@ -29,4 +32,7 @@ import com.epmet.entity.stats.FactTagViewedAgencyDailyEntity;
public interface FactTagViewedAgencyDailyService extends BaseService<FactTagViewedAgencyDailyEntity> {
Boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactTagViewedAgencyDailyEntity> values);
List<FactTagViewedAgencyDailyEntity> getTagViewedCountByMonth(String customerId, String monthId);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyMonthlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量机关月统计表
*
@ -28,4 +30,9 @@ import com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity;
*/
public interface FactTagViewedAgencyMonthlyService extends BaseService<FactTagViewedAgencyMonthlyEntity> {
Boolean deleteAndInsertByMonthId(String customerId, String monthId, List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList);
List<FactTagViewedAgencyMonthlyEntity> getTagViewedCountByQuarterId(String customerId, String quarterId);
List<FactTagViewedAgencyMonthlyEntity> getTagViewedCountByYearId(String customerId, String yearId);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyQuarterlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedAgencyQuarterlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量机关季度统计表
*
@ -28,4 +30,5 @@ import com.epmet.entity.stats.FactTagViewedAgencyQuarterlyEntity;
*/
public interface FactTagViewedAgencyQuarterlyService extends BaseService<FactTagViewedAgencyQuarterlyEntity> {
Boolean deleteAndInsertByQuarterId(String customerId, String quarterId, List<FactTagViewedAgencyQuarterlyEntity> agencyQuarterlyList);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedAgencyYearlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedAgencyYearlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量机关年度统计表
*
@ -29,4 +31,5 @@ import com.epmet.entity.stats.FactTagViewedAgencyYearlyEntity;
public interface FactTagViewedAgencyYearlyService extends BaseService<FactTagViewedAgencyYearlyEntity> {
Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagViewedAgencyYearlyEntity> agencyYearlyList);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridDailyService.java

@ -20,6 +20,9 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedGridDailyEntity;
import java.util.Collection;
import java.util.List;
/**
* 文章引用标签阅读数量网格日统计表
*
@ -28,4 +31,7 @@ import com.epmet.entity.stats.FactTagViewedGridDailyEntity;
*/
public interface FactTagViewedGridDailyService extends BaseService<FactTagViewedGridDailyEntity> {
Boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactTagViewedGridDailyEntity> values);
List<FactTagViewedGridDailyEntity> getTagViewedCountByMonth(String customerId, String monthId);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridMonthlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedGridMonthlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量网格月统计表
*
@ -28,4 +30,9 @@ import com.epmet.entity.stats.FactTagViewedGridMonthlyEntity;
*/
public interface FactTagViewedGridMonthlyService extends BaseService<FactTagViewedGridMonthlyEntity> {
Boolean deleteAndInsertByMonthId(String customerId, String monthId, List<FactTagViewedGridMonthlyEntity> gridMonthlyList);
List<FactTagViewedGridMonthlyEntity> getTagViewedCountByQuarterId(String customerId, String quarterId);
List<FactTagViewedGridMonthlyEntity> getTagViewedCountByYearId(String customerId, String yearId);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridQuarterlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedGridQuarterlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量网格季度统计表
*
@ -28,4 +30,5 @@ import com.epmet.entity.stats.FactTagViewedGridQuarterlyEntity;
*/
public interface FactTagViewedGridQuarterlyService extends BaseService<FactTagViewedGridQuarterlyEntity> {
Boolean deleteAndInsertByQuarterId(String customerId, String quarterId, List<FactTagViewedGridQuarterlyEntity> gridQuarterlyList);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTagViewedGridYearlyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactTagViewedGridYearlyEntity;
import java.util.List;
/**
* 文章引用标签阅读数量网格年度统计表
*
@ -28,4 +30,5 @@ import com.epmet.entity.stats.FactTagViewedGridYearlyEntity;
*/
public interface FactTagViewedGridYearlyService extends BaseService<FactTagViewedGridYearlyEntity> {
Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagViewedGridYearlyEntity> gridYearlyList);
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedAgencyMonthlyServiceImpl.java

@ -22,7 +22,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagUsedAgencyMonthlyDao;
import com.epmet.entity.stats.FactTagUsedAgencyMonthlyEntity;
import com.epmet.entity.stats.FactTagUsedGridMonthlyEntity;
import com.epmet.service.stats.FactTagUsedAgencyMonthlyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -43,19 +42,19 @@ import java.util.List;
public class FactTagUsedAgencyMonthlyServiceImpl extends BaseServiceImpl<FactTagUsedAgencyMonthlyDao, FactTagUsedAgencyMonthlyEntity> implements FactTagUsedAgencyMonthlyService {
@Override
public List<FactTagUsedGridMonthlyEntity> getTagUsedCountByYearId(String customerId, String monthId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(monthId)){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
public List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagUsedCountByYearId(customerId,monthId);
return baseDao.getTagUsedCountByYearId(customerId, yearId);
}
@Override
public List<FactTagUsedGridMonthlyEntity> getTagUsedCountByQuarterId(String customerId, String quarterId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId)){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
public List<FactTagUsedAgencyMonthlyEntity> getTagUsedCountByQuarterId(String customerId, String quarterId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagUsedCountByQuarterId(customerId,quarterId);
return baseDao.getTagUsedCountByQuarterId(customerId, quarterId);
}
@Override

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedAgencyYearlyServiceImpl.java

@ -26,6 +26,10 @@ import com.epmet.service.stats.FactTagUsedAgencyYearlyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 标签机关年度统计表
@ -39,9 +43,19 @@ public class FactTagUsedAgencyYearlyServiceImpl extends BaseServiceImpl<FactTagU
@Override
public int deleteByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.deleteByYearId(customerId, yearId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedAgencyYearlyEntity> agencyYearlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId) || CollectionUtils.isEmpty(agencyYearlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.deleteByYearId(customerId,yearId);
baseDao.deleteByYearId(customerId, yearId);
return this.insertBatch(agencyYearlyList, 100);
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedDepartmentYearlyServiceImpl.java

@ -26,6 +26,9 @@ import com.epmet.service.stats.FactTagUsedDepartmentYearlyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 标签部门年度统计表
@ -38,10 +41,11 @@ import org.springframework.stereotype.Service;
public class FactTagUsedDepartmentYearlyServiceImpl extends BaseServiceImpl<FactTagUsedDepartmentYearlyDao, FactTagUsedDepartmentYearlyEntity> implements FactTagUsedDepartmentYearlyService {
@Override
public Integer deleteByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
public Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedDepartmentYearlyEntity> gridYearlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId) || CollectionUtils.isEmpty(gridYearlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.deleteByYearId(customerId,yearId);
baseDao.deleteByYearId(customerId, yearId);
return this.insertBatch(gridYearlyList, 100);
}
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagUsedGridYearlyServiceImpl.java

@ -25,6 +25,10 @@ import com.epmet.entity.stats.FactTagUsedGridYearlyEntity;
import com.epmet.service.stats.FactTagUsedGridYearlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 标签网格年度统计表
@ -36,11 +40,12 @@ import org.springframework.stereotype.Service;
public class FactTagUsedGridYearlyServiceImpl extends BaseServiceImpl<FactTagUsedGridYearlyDao, FactTagUsedGridYearlyEntity> implements FactTagUsedGridYearlyService {
@Override
public Integer deleteByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
@Transactional(rollbackFor = Exception.class)
public Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagUsedGridYearlyEntity> gridYearlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId) || CollectionUtils.isEmpty(gridYearlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.deleteByYearId(customerId,yearId);
baseDao.deleteByYearId(customerId, yearId);
return this.insertBatch(gridYearlyList, 100);
}
}

62
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyDailyServiceImpl.java

@ -0,0 +1,62 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedAgencyDailyDao;
import com.epmet.entity.stats.FactTagViewedAgencyDailyEntity;
import com.epmet.service.stats.FactTagViewedAgencyDailyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collection;
import java.util.List;
/**
* 文章引用标签阅读数量机关日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Slf4j
@Service
public class FactTagViewedAgencyDailyServiceImpl extends BaseServiceImpl<FactTagViewedAgencyDailyDao, FactTagViewedAgencyDailyEntity> implements FactTagViewedAgencyDailyService {
@Override
public Boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactTagViewedAgencyDailyEntity> values) {
if (CollectionUtils.isEmpty(values)) {
return false;
}
int i = baseDao.deleteByDateId(customerId, dateId);
log.debug("deleteAndInsertBatch delete customerId:{},rows:{}", customerId, i);
this.insertBatch(values, 100);
return true;
}
@Override
public List<FactTagViewedAgencyDailyEntity> getTagViewedCountByMonth(String customerId, String monthId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(monthId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagViewedCountByMonthId(customerId, monthId);
}
}

65
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyMonthlyServiceImpl.java

@ -0,0 +1,65 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedAgencyMonthlyDao;
import com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity;
import com.epmet.service.stats.FactTagViewedAgencyMonthlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量机关月统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedAgencyMonthlyServiceImpl extends BaseServiceImpl<FactTagViewedAgencyMonthlyDao, FactTagViewedAgencyMonthlyEntity> implements FactTagViewedAgencyMonthlyService {
@Override
public Boolean deleteAndInsertByMonthId(String customerId, String monthId, List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(monthId) || CollectionUtils.isEmpty(agencyMonthlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByMonthId(customerId, monthId);
return this.insertBatch(agencyMonthlyList, 100);
}
@Override
public List<FactTagViewedAgencyMonthlyEntity> getTagViewedCountByQuarterId(String customerId, String quarterId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagViewedCountByQuarterId(customerId, quarterId);
}
@Override
public List<FactTagViewedAgencyMonthlyEntity> getTagViewedCountByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagUsedCountByYearId(customerId, yearId);
}
}

49
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyQuarterlyServiceImpl.java

@ -0,0 +1,49 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedAgencyQuarterlyDao;
import com.epmet.entity.stats.FactTagViewedAgencyQuarterlyEntity;
import com.epmet.service.stats.FactTagViewedAgencyQuarterlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量机关季度统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedAgencyQuarterlyServiceImpl extends BaseServiceImpl<FactTagViewedAgencyQuarterlyDao, FactTagViewedAgencyQuarterlyEntity> implements FactTagViewedAgencyQuarterlyService {
@Override
public Boolean deleteAndInsertByQuarterId(String customerId, String quarterId, List<FactTagViewedAgencyQuarterlyEntity> agencyQuarterlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId) || CollectionUtils.isEmpty(agencyQuarterlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByQuarterId(customerId, quarterId);
return this.insertBatch(agencyQuarterlyList, 100);
}
}

49
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedAgencyYearlyServiceImpl.java

@ -0,0 +1,49 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedAgencyYearlyDao;
import com.epmet.entity.stats.FactTagViewedAgencyYearlyEntity;
import com.epmet.service.stats.FactTagViewedAgencyYearlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量机关年度统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedAgencyYearlyServiceImpl extends BaseServiceImpl<FactTagViewedAgencyYearlyDao, FactTagViewedAgencyYearlyEntity> implements FactTagViewedAgencyYearlyService {
@Override
public Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagViewedAgencyYearlyEntity> agencyYearlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId) || CollectionUtils.isEmpty(agencyYearlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByYearId(customerId, yearId);
return this.insertBatch(agencyYearlyList, 100);
}
}

64
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridDailyServiceImpl.java

@ -0,0 +1,64 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedGridDailyDao;
import com.epmet.entity.stats.FactTagViewedGridDailyEntity;
import com.epmet.service.stats.FactTagViewedGridDailyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Collection;
import java.util.List;
/**
* 文章引用标签阅读数量网格日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Slf4j
@Service
public class FactTagViewedGridDailyServiceImpl extends BaseServiceImpl<FactTagViewedGridDailyDao, FactTagViewedGridDailyEntity> implements FactTagViewedGridDailyService {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactTagViewedGridDailyEntity> values) {
if (CollectionUtils.isEmpty(values)) {
return false;
}
int i = baseDao.deleteByDateId(customerId, dateId);
log.debug("deleteAndInsertBatch delete customerId:{},rows:{}", customerId, i);
this.insertBatch(values, 100);
return true;
}
@Override
public List<FactTagViewedGridDailyEntity> getTagViewedCountByMonth(String customerId, String monthId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(monthId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagViewedCountByMonthId(customerId, monthId);
}
}

65
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridMonthlyServiceImpl.java

@ -0,0 +1,65 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedGridMonthlyDao;
import com.epmet.entity.stats.FactTagViewedGridMonthlyEntity;
import com.epmet.service.stats.FactTagViewedGridMonthlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量网格月统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedGridMonthlyServiceImpl extends BaseServiceImpl<FactTagViewedGridMonthlyDao, FactTagViewedGridMonthlyEntity> implements FactTagViewedGridMonthlyService {
@Override
public Boolean deleteAndInsertByMonthId(String customerId, String monthId, List<FactTagViewedGridMonthlyEntity> gridMonthlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(monthId) || CollectionUtils.isEmpty(gridMonthlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByMonthId(customerId, monthId);
return this.insertBatch(gridMonthlyList, 100);
}
@Override
public List<FactTagViewedGridMonthlyEntity> getTagViewedCountByQuarterId(String customerId, String quarterId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagViewCountByQuarterId(customerId, quarterId);
}
@Override
public List<FactTagViewedGridMonthlyEntity> getTagViewedCountByYearId(String customerId, String yearId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getTagUsedCountByYearId(customerId, yearId);
}
}

49
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridQuarterlyServiceImpl.java

@ -0,0 +1,49 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedGridQuarterlyDao;
import com.epmet.entity.stats.FactTagViewedGridQuarterlyEntity;
import com.epmet.service.stats.FactTagViewedGridQuarterlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量网格季度统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedGridQuarterlyServiceImpl extends BaseServiceImpl<FactTagViewedGridQuarterlyDao, FactTagViewedGridQuarterlyEntity> implements FactTagViewedGridQuarterlyService {
@Override
public Boolean deleteAndInsertByQuarterId(String customerId, String quarterId, List<FactTagViewedGridQuarterlyEntity> gridQuarterlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(quarterId) || CollectionUtils.isEmpty(gridQuarterlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByQuarterId(customerId, quarterId);
return this.insertBatch(gridQuarterlyList, 100);
}
}

49
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTagViewedGridYearlyServiceImpl.java

@ -0,0 +1,49 @@
/**
* 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.stats.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dao.stats.FactTagViewedGridYearlyDao;
import com.epmet.entity.stats.FactTagViewedGridYearlyEntity;
import com.epmet.service.stats.FactTagViewedGridYearlyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 文章引用标签阅读数量网格年度统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Service
public class FactTagViewedGridYearlyServiceImpl extends BaseServiceImpl<FactTagViewedGridYearlyDao, FactTagViewedGridYearlyEntity> implements FactTagViewedGridYearlyService {
@Override
public Boolean deleteAndInsertByYearId(String customerId, String yearId, List<FactTagViewedGridYearlyEntity> gridYearlyList) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(yearId) || CollectionUtils.isEmpty(gridYearlyList)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.deleteByYearId(customerId, yearId);
return this.insertBatch(gridYearlyList, 100);
}
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleTagsService.java

@ -31,12 +31,15 @@ import java.util.List;
*/
public interface ArticleTagsService extends BaseService<ArticleTagsEntity> {
/**
* desc:根据客户Id 创建时间获取 文章便签数据
* @param customerId
* @param startTime
* @param endTime
* @return
*/
List<ArticleTagsEntity> getArticleTagsByCreateTime(String customerId, Date startTime, Date endTime);
/**
* desc:根据客户Id 创建时间获取 文章便签数据
*
* @param customerId
* @param startTime
* @param endTime
* @return
*/
List<ArticleTagsEntity> getArticleTagsByCreateTime(String customerId, Date startTime, Date endTime);
List<ArticleTagsEntity> getArticleTagsByArticleId(String customerId, String articleId);
}

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleVisitRecordService.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;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.voice.ArticleViewedSummaryDTO;
import com.epmet.entity.voice.ArticleVisitRecordEntity;
import java.util.Date;
import java.util.List;
/**
* 文章访问记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
public interface ArticleVisitRecordService extends BaseService<ArticleVisitRecordEntity> {
/**
* desc根据客户Id
*
* @param customerId
* @param startTime
* @param endTime
* @return
*/
List<ArticleViewedSummaryDTO> getArticleVisitByCreateTime(String customerId, Date startTime, Date endTime);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleTagsServiceImpl.java

@ -45,10 +45,19 @@ public class ArticleTagsServiceImpl extends BaseServiceImpl<ArticleTagsDao, Arti
@Override
public List<ArticleTagsEntity> getArticleTagsByCreateTime(String customerId, Date startTime, Date endTime) {
this.checkParam(customerId,endTime,endTime);
return baseDao.getArticleTagsByDay(customerId,startTime, endTime);
this.checkParam(customerId, endTime, endTime);
return baseDao.getArticleTagsByDay(customerId, startTime, endTime);
}
private void checkParam(String customerId, Date starTime,Date endTime) {
@Override
public List<ArticleTagsEntity> getArticleTagsByArticleId(String customerId, String articleId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(articleId)) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getArticleTagsByArticleId(customerId, articleId);
}
private void checkParam(String customerId, Date starTime, Date endTime) {
if (StringUtils.isBlank(customerId) || starTime == null || endTime == null) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}

54
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleVisitRecordServiceImpl.java

@ -0,0 +1,54 @@
/**
* 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.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.voice.ArticleVisitRecordDao;
import com.epmet.dto.voice.ArticleViewedSummaryDTO;
import com.epmet.entity.voice.ArticleVisitRecordEntity;
import com.epmet.service.voice.ArticleVisitRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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 ArticleVisitRecordServiceImpl extends BaseServiceImpl<ArticleVisitRecordDao, ArticleVisitRecordEntity> implements ArticleVisitRecordService {
@Override
public List<ArticleViewedSummaryDTO> getArticleVisitByCreateTime(String customerId, Date startTime, Date endTime) {
if (StringUtils.isBlank(customerId) || startTime == null || endTime == null) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getArticleVisitByCreateTime(customerId, startTime, endTime);
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml

@ -3,7 +3,7 @@
<mapper namespace="com.epmet.dao.stats.FactTagUsedAgencyMonthlyDao">
<select id="getTagUsedCountByYearId" resultType="com.epmet.entity.stats.FactTagUsedGridMonthlyEntity">
<select id="getTagUsedCountByYearId" resultType="com.epmet.entity.stats.FactTagUsedAgencyMonthlyEntity">
SELECT
CUSTOMER_ID,
PID,
@ -25,7 +25,7 @@
AGENCY_ID,
TAG_ID
</select>
<select id="getTagUsedCountByQuarterId" resultType="com.epmet.entity.stats.FactTagUsedGridMonthlyEntity">
<select id="getTagUsedCountByQuarterId" resultType="com.epmet.entity.stats.FactTagUsedAgencyMonthlyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID,

45
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml

@ -3,26 +3,31 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedAgencyDailyDao">
<resultMap type="com.epmet.entity.stats.FactTagViewedAgencyDailyEntity" id="factTagViewedAgencyDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pid" column="PID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="tagReadCount" column="TAG_READ_COUNT"/>
<result property="dateId" column="DATE_ID"/>
<result property="weekId" column="WEEK_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="quarterId" column="QUARTER_ID"/>
<result property="yearId" column="YEAR_ID"/>
<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>
<delete id="deleteByDateId">
DELETE FROM fact_tag_viewed_agency_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR}
</delete>
<select id="getTagViewedCountByMonthId" resultType="com.epmet.entity.stats.FactTagViewedAgencyDailyEntity">
SELECT
CUSTOMER_ID,
PID,
AGENCY_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_agency_daily
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
AGENCY_ID,
TAG_ID
</select>
</mapper>

62
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml

@ -3,22 +3,52 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedAgencyMonthlyDao">
<resultMap type="com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity" id="factTagViewedAgencyMonthlyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pid" column="PID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="tagReadCount" column="TAG_READ_COUNT"/>
<result property="monthId" column="MONTH_ID"/>
<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>
<delete id="deleteByMonthId">
DELETE FROM fact_tag_viewed_agency_monthly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
</delete>
<select id="getTagViewedCountByQuarterId" resultType="com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_agency_monthly
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND QUARTER_ID = #{quarterId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
AGENCY_ID,
TAG_ID
</select>
<select id="getTagUsedCountByYearId" resultType="com.epmet.entity.stats.FactTagViewedAgencyMonthlyEntity">
SELECT
CUSTOMER_ID,
PID,
AGENCY_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_agency_monthly
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND YEAR_ID = #{yearId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
AGENCY_ID,
TAG_ID
</select>
</mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyQuarterlyDao.xml

@ -2,23 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.FactTagViewedAgencyQuarterlyDao">
<resultMap type="com.epmet.entity.stats.FactTagViewedAgencyQuarterlyEntity" id="factTagViewedAgencyQuarterlyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pid" column="PID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="tagReadCount" column="TAG_READ_COUNT"/>
<result property="quarterId" column="QUARTER_ID"/>
<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>
<delete id="deleteByQuarterId">
DELETE FROM fact_tag_viewed_agency_quarterly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND QUARTER_ID = #{quarterId,jdbcType=VARCHAR}
</delete>
</mapper>

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyYearlyDao.xml

@ -3,22 +3,9 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedAgencyYearlyDao">
<resultMap type="com.epmet.entity.stats.FactTagViewedAgencyYearlyEntity" id="factTagViewedAgencyYearlyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pid" column="PID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="tagReadCount" column="TAG_READ_COUNT"/>
<result property="yearId" column="YEAR_ID"/>
<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>
<delete id="deleteByYearId">
DELETE FROM fact_tag_viewed_agency_yearly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND YEAR_ID = #{yearId,jdbcType=VARCHAR}
</delete>
</mapper>

25
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml

@ -4,4 +4,29 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedGridDailyDao">
<delete id="deleteByDateId">
DELETE FROM fact_tag_viewed_grid_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR}
</delete>
<select id="getTagViewedCountByMonthId" resultType="com.epmet.entity.stats.FactTagViewedGridDailyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_grid_daily
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
GRID_ID,
TAG_ID
</select>
</mapper>

47
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml

@ -3,4 +3,51 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedGridMonthlyDao">
<delete id="deleteByMonthId">
DELETE FROM fact_tag_viewed_grid_monthly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
</delete>
<select id="getTagViewCountByQuarterId" resultType="com.epmet.entity.stats.FactTagViewedGridMonthlyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_grid_monthly
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND QUARTER_ID = #{quarterId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
GRID_ID,
TAG_ID
</select>
<select id="getTagUsedCountByYearId" resultType="com.epmet.entity.stats.FactTagViewedGridMonthlyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
TAG_ID,
TAG_NAME,
COUNT( TAG_READ_COUNT ) TAG_READ_COUNT,
MONTH_ID,
QUARTER_ID,
YEAR_ID
FROM
fact_tag_viewed_grid_monthly
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND YEAR_ID = #{yearId,jdbcType=VARCHAR}
GROUP BY
CUSTOMER_ID,
GRID_ID,
TAG_ID
</select>
</mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridQuarterlyDao.xml

@ -3,4 +3,7 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedGridQuarterlyDao">
<delete id="deleteByQuarterId">
DELETE FROM fact_tag_viewed_grid_quarterly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND QUARTER_ID = #{quarterId,jdbcType=VARCHAR}
</delete>
</mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridYearlyDao.xml

@ -3,4 +3,7 @@
<mapper namespace="com.epmet.dao.stats.FactTagViewedGridYearlyDao">
<delete id="deleteByYearId">
DELETE FROM fact_tag_viewed_grid_yearly WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND YEAR_ID = #{yearId,jdbcType=VARCHAR}
</delete>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleTagsDao.xml

@ -29,4 +29,17 @@
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND CREATED_TIME BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}
</select>
<select id="getArticleTagsByArticleId" resultMap="articleTagsMap">
SELECT
TAG_ID,
TAG_NAME,
CUSTOMER_ID,
ARTICLE_ID
FROM
article_tags
WHERE
ARTICLE_ID = #{articleId,jdbcType=VARCHAR}
AND DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</select>
</mapper>

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleVisitRecordDao.xml

@ -0,0 +1,23 @@
<?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.ArticleVisitRecordDao">
<select id="getArticleVisitByCreateTime" resultType="com.epmet.dto.voice.ArticleViewedSummaryDTO">
SELECT
CUSTOMER_ID,
GRID_ID,
ARTICLE_ID,
COUNT( USER_ID ) AS viewedCount
FROM
article_visit_record
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND CREATED_TIME BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}
GROUP BY
CUSTOMER_ID,
ARTICLE_ID
</select>
</mapper>
Loading…
Cancel
Save