Browse Source

按日部门统计

dev_shibei_match
jianjun 6 years ago
parent
commit
090bf3fed3
  1. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java
  2. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java
  3. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java
  5. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java
  7. 126
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  8. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java
  9. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java
  10. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java
  11. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java
  12. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java
  13. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql
  14. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml
  15. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml
  16. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml
  17. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java

@ -23,10 +23,20 @@ public class ArticleGridPublishedSummaryDTO implements Serializable {
* 客户id
*/
private String customerId;
/**
* 机关id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 发布者Id publish_type类型为 部门时 是部门id类型为 机关时 是机关Id
*/
private String publisherId;
/**
* 发布文章总数
*/

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -30,5 +30,17 @@ public interface ProjectConstant {
* 项目处理进展-结案
*/
String CLOSE = "close";
/**
* 发布单位类型 机关:agency
*/
String PUBLISH_TYPE_AGENCY = "agency";
/**
* 发布单位类型 部门department
*/
String PUBLISH_TYPE_DEPT = "department";
/**
* 发布单位类型 网格grid
*/
String PUBLISH_TYPE_GRID = "grid";
}

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

@ -20,6 +20,9 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.DimDepartmentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户部门维度
@ -30,4 +33,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DimDepartmentDao extends BaseDao<DimDepartmentEntity> {
int insertOne(DimDepartmentEntity dim);
/**
* desc:根据客户Id获取所有的部门信息
* @param customerId
* @return
*/
List<DimDepartmentEntity> getDepartmentListByCustomerId(@Param("customerId") String customerId);
}

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

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 文章发布数量部门日统计表
@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface FactArticlePublishedDepartmentDailyDao extends BaseDao<FactArticlePublishedDepartmentDailyEntity> {
/**
* desc:根据客户id日期 删除数据
* @param customerId
* @param dateId
* @return
*/
int deleteByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java

@ -18,8 +18,13 @@
package com.epmet.dao.voice;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 文章表
@ -29,5 +34,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ArticleDao extends BaseDao<ArticleEntity> {
/**
* desc:根据客户Id 和发布时间 获取文章总数
*
* @param customerId
* @param publishDate
* @param publishType
* @return
*/
List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(@Param("customerId") String customerId, @Param("publishDate") Date publishDate, @Param("publishType") String publishType);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java

@ -48,7 +48,7 @@ public class FactArticlePublishedDepartmentDailyEntity extends BaseEpmetEntity {
/**
* 部门ID
*/
private String depsartmentId;
private String departmentId;
/**
* 文章累计发文数量 文章数量

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

@ -3,11 +3,11 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.stats.DimGridEntity;
import com.epmet.entity.stats.FactArticlePublishedGridDailyEntity;
import com.epmet.entity.stats.*;
import com.epmet.service.StatsPublicityService;
import com.epmet.service.stats.*;
import com.epmet.service.voice.ArticlePublishRangeService;
import com.epmet.service.voice.ArticleService;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -46,11 +46,17 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
private DimCustomerService dimCustomerService;
@Autowired
private DimGridService dimGridService;
@Autowired
private DimDepartmentService dimDepartmentService;
@Autowired
private ArticleService articleService;
@Autowired
private ArticlePublishRangeService articlePublishRangeService;
@Autowired
private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService;
@Autowired
private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService;
@Autowired
private ExecutorService executorService;
@ -71,21 +77,78 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
/*executorService.submit(()->{
});*/
statsPublishedGridDaily(statsDate, dimIdBean, customerId);
//key:所在机关Id
Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap = new HashMap<>();
statsPublishedGridDaily(statsDate, dimIdBean, customerId,agencySummaryMap);
statsPublishedDepartmentDaily(statsDate, dimIdBean, customerId,agencySummaryMap);
statsPublishedAgencyDaily(statsDate, dimIdBean, customerId,agencySummaryMap);
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize);
return true;
}
private void statsPublishedDepartmentDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap) {
//获取所有客户
List<DimDepartmentEntity> departmentDTOList = dimDepartmentService.getDepartmentListByCustomerId(customerId);
if (CollectionUtils.isEmpty(departmentDTOList)) {
log.warn("publicitySummary getDepartmentListByCustomerId return empty,customerId:{}", customerId);
return;
}
//转换为 需要插入的Entity
Map<String, FactArticlePublishedDepartmentDailyEntity> departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean);
//获取当天的业务数据
List<ArticleGridPublishedSummaryDTO> publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN));
if (!CollectionUtils.isEmpty(publishedArticleCount)) {
for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) {
FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId());
if (gridDailyEntities == null) {
log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId());
continue;
}
gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount());
gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount());
//同一个机关下数据累加
buildAgencySummaryData(agencySummaryMap, summaryDTO);
}
}
boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values());
}
/**
* desc:同一个机关下的数据进行类型处理
* @param result
* @param summaryDTO
*/
private void buildAgencySummaryData(Map<String, ArticleGridPublishedSummaryDTO> result, ArticleGridPublishedSummaryDTO summaryDTO) {
//同一个机关下数据累加
ArticleGridPublishedSummaryDTO publishedSummaryDTO = result.get(summaryDTO.getAgencyId());
if (publishedSummaryDTO == null) {
ArticleGridPublishedSummaryDTO summary = new ArticleGridPublishedSummaryDTO();
summary.setCustomerId(summaryDTO.getCustomerId());
summary.setAgencyId(summaryDTO.getAgencyId());
summary.setGridId(summaryDTO.getGridId());
summary.setPublisherId(summaryDTO.getPublisherId());
summary.setArticleTotalCount(summaryDTO.getArticleTotalCount());
summary.setArticlePublishedCount(summaryDTO.getArticlePublishedCount());
result.put(summaryDTO.getPublisherId(),summaryDTO);
}else{
publishedSummaryDTO.setArticlePublishedCount(publishedSummaryDTO.getArticlePublishedCount()+summaryDTO.getArticlePublishedCount());
publishedSummaryDTO.setArticleTotalCount(publishedSummaryDTO.getArticleTotalCount()+summaryDTO.getArticlePublishedCount());
}
}
/**
* desc:按日统计 网格纬度的 文章总数数据
*
* @param statsDate
* @param statsDate
* @param dimIdBean
* @param customerId
* @param agencySummaryMap
*/
private void statsPublishedGridDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) {
private void statsPublishedGridDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap) {
//key:所在机关Id
Map<String,ArticleGridPublishedSummaryDTO> result = new HashMap<>();
//获取所有网格
List<DimGridEntity> gridDTOList = dimGridService.getGridListByCustomerId(customerId);
if (CollectionUtils.isEmpty(gridDTOList)) {
@ -106,11 +169,41 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
}
gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount());
gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount());
//同一个机关下数据累加
buildAgencySummaryData(agencySummaryMap, summaryDTO);
}
}
boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values());
}
private void statsPublishedAgencyDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap) {
//获取所有客户
List<DimAgencyEntity> departmentDTOList = dimAgencyService.getAgencyListByCustomerId(customerId);
if (CollectionUtils.isEmpty(departmentDTOList)) {
log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId);
return;
}
//转换为 需要插入的Entity
Map<String, FactArticlePublishedDepartmentDailyEntity> departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean);
//获取当天的业务数据
List<ArticleGridPublishedSummaryDTO> publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN));
if (!CollectionUtils.isEmpty(publishedArticleCount)) {
for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) {
FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId());
if (gridDailyEntities == null) {
log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId());
continue;
}
gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount());
gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount());
//同一个机关下数据累加
buildAgencySummaryData(agencySummaryMap, summaryDTO);
}
}
boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values());
}
/**
* desc:将网格对象构建为 gridDaily 对象
*
@ -131,4 +224,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
});
return result;
}
/**
* desc:将网格对象构建为 gridDaily 对象
*
* @param dimDepartmentEntities
* @param dimIdBean
* @return
*/
private Map<String, FactArticlePublishedDepartmentDailyEntity> convertDepartmentDailyEntity(List<DimDepartmentEntity> dimDepartmentEntities, DimIdGenerator.DimIdBean dimIdBean) {
Map<String, FactArticlePublishedDepartmentDailyEntity> result = new HashMap<>();
dimDepartmentEntities.forEach(dimGridEntity -> {
FactArticlePublishedDepartmentDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedDepartmentDailyEntity.class);
entity.setCustomerId(dimGridEntity.getCustomerId());
entity.setAgencyId(dimGridEntity.getAgencyId());
entity.setDepartmentId(dimGridEntity.getId());
entity.setArticleTotalCount(0);
entity.setArticlePublishedCount(0);
result.put(dimGridEntity.getId(), entity);
});
return result;
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java

@ -20,6 +20,8 @@ package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity;
import java.util.Collection;
/**
* 文章发布数量部门日统计表
*
@ -28,4 +30,15 @@ import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity;
*/
public interface FactArticlePublishedDepartmentDailyService extends BaseService<FactArticlePublishedDepartmentDailyEntity> {
/**
* desc: 删除并插入数据
*
* @param dateId
* @param values
* @return:
* @date: 2020/6/18 14:54
* @author: jianjun liu
*/
boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactArticlePublishedDepartmentDailyEntity> values);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java

@ -20,16 +20,16 @@ package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.stats.DimDepartmentDao;
import com.epmet.dto.stats.DimDepartmentDTO;
import com.epmet.entity.org.CustomerDepartmentEntity;
import com.epmet.entity.stats.DimDepartmentEntity;
import com.epmet.service.stats.DimDepartmentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,6 +44,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-16
*/
@Slf4j
@Service
public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao, DimDepartmentEntity> implements DimDepartmentService {
@ -118,4 +119,12 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
baseDao.insertOne(dim);
}
}
@Override
public List<DimDepartmentEntity> getDepartmentListByCustomerId(String customerId) {
if (StringUtils.isBlank(customerId)){
log.warn("getDepartmentListByCustomerId param is blank ");
}
return baseDao.getDepartmentListByCustomerId(customerId);
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java

@ -21,16 +21,27 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.stats.FactArticlePublishedDepartmentDailyDao;
import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity;
import com.epmet.service.stats.FactArticlePublishedDepartmentDailyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Collection;
/**
* 文章发布数量部门日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-18
*/
@Slf4j
@Service
public class FactArticlePublishedDepartmentDailyServiceImpl extends BaseServiceImpl<FactArticlePublishedDepartmentDailyDao, FactArticlePublishedDepartmentDailyEntity> implements FactArticlePublishedDepartmentDailyService {
@Override
public boolean deleteAndInsertBatch(String customerId, String dateId, Collection<FactArticlePublishedDepartmentDailyEntity> values) {
int i = baseDao.deleteByDateId(customerId, dateId);
log.debug("deleteAndInsertBatch delete customerId:{},rows:{}", customerId,i);
this.insertBatch(values, 100);
return true;
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java

@ -18,8 +18,12 @@
package com.epmet.service.voice;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticleEntity;
import java.util.Date;
import java.util.List;
/**
* desc: 数据统计文章service
*
@ -30,4 +34,11 @@ import com.epmet.entity.voice.ArticleEntity;
*/
public interface ArticleService extends BaseService<ArticleEntity> {
/**
* desc:根据客户id发布时间 获取文章总数
* @param customerId
* @param publishDate
* @return
*/
List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(String customerId, Date publishDate);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java

@ -19,13 +19,20 @@ 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.constant.ProjectConstant;
import com.epmet.dao.voice.ArticleDao;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticleEntity;
import com.epmet.service.voice.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 项目表
*
@ -35,7 +42,12 @@ import org.springframework.stereotype.Service;
@Service
@DataSource(DataSourceConstant.GOV_VOICE)
public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntity> implements ArticleService {
@Autowired
private ArticleDao articleDao;
@Override
public List<ArticleGridPublishedSummaryDTO> getAllPublishedCount(String customerId, Date publishDate) {
if (StringUtils.isBlank(customerId) || publishDate == null){
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
return baseDao.getAllPublishedCount(customerId,publishDate, ProjectConstant.PUBLISH_TYPE_DEPT);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql

@ -56,7 +56,7 @@ CREATE TABLE `fact_article_published_department_daily` (
`ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID',
`CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID',
`AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布文章单位所属机关ID 发布文章单位所属机关ID',
`DEPSARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID',
`DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID',
`ARTICLE_TOTAL_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章累计发文数量 文章数量',
`ARTICLE_PUBLISHED_COUNT` int(11) NULL DEFAULT NULL COMMENT '当前发文数量 当前未下线的文章数量',
`DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 日期ID',

11
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml

@ -8,4 +8,15 @@
updated_by, updated_time)
VALUE (#{id}, #{departmentName}, #{agencyId}, #{customerId}, #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime})
</insert>
<select id="getDepartmentListByCustomerId" resultType="com.epmet.entity.stats.DimDepartmentEntity">
SELECT
ID,
AGENCY_ID,
CUSTOMER_ID
FROM
dim_department
WHERE
DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</select>
</mapper>

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml

@ -7,7 +7,7 @@
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="depsartmentId" column="DEPSARTMENT_ID"/>
<result property="departmentId" column="DEPSARTMENT_ID"/>
<result property="articleTotalCount" column="ARTICLE_TOTAL_COUNT"/>
<result property="articlePublishedCount" column="ARTICLE_PUBLISHED_COUNT"/>
<result property="dateId" column="DATE_ID"/>
@ -22,6 +22,9 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByDateId">
DELETE FROM fact_article_published_department_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR}
</delete>
</mapper>

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

@ -29,6 +29,23 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getAllPublishedCount" resultType="com.epmet.dto.stats.ArticleGridPublishedSummaryDTO">
SELECT
ORG_ID AS agencyId,
PUBLISHER_ID,
count(ID) articleTotalCount,
sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) articlePublishedCount
FROM
article_publish_range
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND PUBLISH_TYPE = #{publishType,jdbcType=VARCHAR}
AND PUBLISH_DATE <![CDATA[ <#{publishType,jdbcType=TIMESTAMP}]]>
GROUP BY
CUSTOMER_ID,
PUBLISHER_ID
</select>
</mapper>

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

@ -23,6 +23,7 @@
</resultMap>
<select id="getAllPublishedCount" resultType="com.epmet.dto.stats.ArticleGridPublishedSummaryDTO">
SELECT
AGENCY_ID,
GRID_ID,
count(ID) articleTotalCount,
sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) articlePublishedCount

Loading…
Cancel
Save