diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java index 301099d52b..c1bd1e7043 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java @@ -23,7 +23,10 @@ public class ArticleGridPublishedSummaryDTO implements Serializable { * 客户id */ private String customerId; - + /** + * 上级机关id,顶级为"0" + */ + private String pid; /** * 机关id */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index 0df16681dc..96461ec01a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -33,14 +33,14 @@ public interface ProjectConstant { /** * 发布单位类型 机关:agency */ - String PUBLISH_TYPE_AGENCY = "agency"; + String PUBLISHER_TYPE_AGENCY = "agency"; /** * 发布单位类型 部门:department */ - String PUBLISH_TYPE_DEPT = "department"; + String PUBLISHER_TYPE_DEPT = "department"; /** * 发布单位类型 网格:grid */ - String PUBLISH_TYPE_GRID = "grid"; + String PUBLISHER_TYPE_GRID = "grid"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index 056c65bace..493fade14e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -47,29 +47,36 @@ public interface DimAgencyDao extends BaseDao { List selectDimAgencyList(DimAgencyDTO dto); /** - * @Description 获取所有机关 * @param - * @return List + * @return List + * @Description 获取所有机关 * @author wangc * @date 2020.06.18 09:26 - **/ + **/ List selectAllAgency(); /** - * @Description 根据PID获取下级机关 * @param pid - * @return List + * @return List + * @Description 根据PID获取下级机关 * @author wangc * @date 2020.06.18 09:26 - **/ - List selectSubAgencyByPid(@Param("pid")String pid); + **/ + List selectSubAgencyByPid(@Param("pid") String pid); /** - * @Description 获取顶层级机关机关 * @param - * @return List + * @return List + * @Description 获取顶层级机关机关 * @author wangc * @date 2020.06.18 09:26 **/ List selectTopAgency(); + + /** + * desc:根据客户id 获取机关列表 + * @param customerId + * @return + */ + List getAgencyListByCustomerId(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java index ee299f316c..5a7e9dbfc7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; 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 FactArticlePublishedAgencyDailyDao extends BaseDao { - + /** + * desc:删除数据 + * + * @param customerId + * @param dateId + * @return + */ + int deleteByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java index 6622ffe700..2b23d16345 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java @@ -40,8 +40,8 @@ public interface ArticleDao extends BaseDao { * * @param customerId * @param publishDate - * @param publishType + * @param publisherType * @return */ - List getAllPublishedCount(@Param("customerId") String customerId, @Param("publishDate") Date publishDate, @Param("publishType") String publishType); + List getAllPublishedCount(@Param("customerId") String customerId, @Param("publishDate") Date publishDate, @Param("publisherType") String publisherType); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java index 6c662d9760..fe0d53cf8e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.service.impl; import com.epmet.dto.AgencySubTreeDto; import com.epmet.entity.issue.IssueEntity; import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.service.Issue.DemoIssueService; import com.epmet.service.StatsDemoService; import com.epmet.service.org.DemoGovOrgService; import com.epmet.service.stats.DemoDataStatsService; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index 8dab26fefe..c5dd27ec08 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -1,12 +1,10 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; 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.DimDepartmentEntity; -import com.epmet.entity.stats.DimGridEntity; -import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; -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; @@ -60,14 +58,21 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService; @Autowired private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService; + @Autowired + private FactArticlePublishedAgencyDailyService factArticlePublishedAgencyDailyService; + @Autowired private ExecutorService executorService; @Override public Boolean publicitySummary(Date statsDate) { + //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { - statsDate = DateUtils.addDateDays(new Date(), -1); + //当天的凌晨时间 即为今天之前的数据 + 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; @@ -101,7 +106,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //转换为 需要插入的Entity Map departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); //获取当天的业务数据 - List publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); + List publishedArticleCount = articleService.getAllDepartmentPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); if (!CollectionUtils.isEmpty(publishedArticleCount)) { for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { @@ -162,12 +167,12 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //转换为 需要插入的Entity Map gridDailyEntityMap = convertGridDailyEntity(gridDTOList, dimIdBean); //获取当天的业务数据 - List publishedArticleCount = articlePublishRangeService.getAllPublishedCount(customerId, statsDate); + List publishedArticleCount = articleService.getAllGridPublishedCount(customerId, statsDate); if (!CollectionUtils.isEmpty(publishedArticleCount)) { for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { FactArticlePublishedGridDailyEntity gridDailyEntities = gridDailyEntityMap.get(summaryDTO.getGridId()); if (gridDailyEntities == null) { - log.error("publicitySummary bizData gridId:{} not exist in dimGrid", summaryDTO.getGridId()); + log.error("publicitySummary getAllGridPublishedCount gridId:{} not exist in dimGrid", summaryDTO.getGridId()); continue; } gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); @@ -180,20 +185,20 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { } private void statsPublishedAgencyDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map agencySummaryMap) { - //获取所有客户 - List departmentDTOList = null;//dimAgencyService.getAgencyListByCustomerId(customerId); - if (CollectionUtils.isEmpty(departmentDTOList)) { + //获取所有机关 + List agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId); + if (CollectionUtils.isEmpty(agencyDTOList)) { log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); return; } //转换为 需要插入的Entity - Map departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); + Map agencyDailyEntityMap = convertAgencyDailyEntity(agencyDTOList, dimIdBean); //获取当天的业务数据 - List publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); + List publishedArticleCount = articleService.getAllAgencyPublishedCount(customerId,statsDate); if (!CollectionUtils.isEmpty(publishedArticleCount)) { for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { - FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId()); + FactArticlePublishedAgencyDailyEntity gridDailyEntities = agencyDailyEntityMap.get(summaryDTO.getPublisherId()); if (gridDailyEntities == null) { log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId()); continue; @@ -204,7 +209,35 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { buildAgencySummaryData(agencySummaryMap, summaryDTO); } } - boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); + //数据向上级机关添加 + if (!CollectionUtils.isEmpty(agencySummaryMap)){ + for (Map.Entry entry : agencySummaryMap.entrySet()) { + String agencyId = entry.getKey(); + ArticleGridPublishedSummaryDTO summary = entry.getValue(); + FactArticlePublishedAgencyDailyEntity dailyEntity = agencyDailyEntityMap.get(agencyId); + if (dailyEntity == null) { + log.error("publicitySummary bizData agencyId:{} not exist in dimAgency", agencyId); + continue; + } + setData2ParentAgency(agencyDailyEntityMap,summary, dailyEntity); + } + } + + boolean b = factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); + } + + private void setData2ParentAgency(Map agencyDailyEntityMap, ArticleGridPublishedSummaryDTO agencySummary, FactArticlePublishedAgencyDailyEntity summary) { + String pid = summary.getPid(); + FactArticlePublishedAgencyDailyEntity parentAgency = agencyDailyEntityMap.get(pid); + if (parentAgency == null){ + return; + } + parentAgency.setArticleTotalCount(parentAgency.getArticleTotalCount()+agencySummary.getArticleTotalCount()); + parentAgency.setArticlePublishedCount(parentAgency.getArticlePublishedCount()+agencySummary.getArticlePublishedCount()); + pid = parentAgency.getPid(); + if (!NumConstant.ZERO_STR.equals(pid)){ + setData2ParentAgency(agencyDailyEntityMap, agencySummary,parentAgency); + } } /** @@ -248,4 +281,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { }); return result; } + + /** + * desc:将机关卫队对象构建为 agencyDaily 对象 + * + * @param dimDepartmentEntities + * @param dimIdBean + * @return + */ + private Map convertAgencyDailyEntity(List dimDepartmentEntities, DimIdGenerator.DimIdBean dimIdBean) { + Map result = new HashMap<>(); + dimDepartmentEntities.forEach(dimGridEntity -> { + FactArticlePublishedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedAgencyDailyEntity.class); + entity.setCustomerId(dimGridEntity.getCustomerId()); + entity.setPid(dimGridEntity.getPid()); + entity.setAgencyId(dimGridEntity.getId()); + entity.setArticleTotalCount(0); + entity.setArticlePublishedCount(0); + result.put(dimGridEntity.getId(), entity); + }); + return result; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index 9bb3b433d3..8de5b0045f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -122,4 +122,14 @@ public interface DimAgencyService extends BaseService { * @date 2020.06.18 09:45 **/ List getTopAgency(); + + /** + * desc: 根据客户Id 获取机关列表数据 + * + * @param customerId + * @return: + * @date: 2020/6/18 17:54 + * @author: jianjun liu + */ + List getAgencyListByCustomerId(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java index b674d6ae3e..dc9d7e3d63 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java @@ -20,6 +20,8 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; +import java.util.Collection; + /** * 文章发布数量【机关】日统计表 * @@ -28,5 +30,16 @@ import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; */ public interface FactArticlePublishedAgencyDailyService extends BaseService { + /** + * desc: 删除并插入数据 + * + * @param customerId + * @param dateId + * @param values + * @return: + * @date: 2020/6/18 18:59 + * @author: jianjun liu + */ + boolean deleteAndInsertBatch(String customerId, String dateId, Collection values); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index 6f0c1b3046..26a692d594 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -20,6 +20,8 @@ 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; @@ -113,9 +115,10 @@ public class DimAgencyServiceImpl extends BaseServiceImpl agencies) { + Date now = new Date(); for (CustomerAgencyEntity agency : agencies) { DimAgencyEntity dimAgencyEntity = new DimAgencyEntity(); dimAgencyEntity.setAgencyName(agency.getOrganizationName()); @@ -156,4 +159,12 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getAgencyListByCustomerId(String customerId) { + if (StringUtils.isBlank(customerId)){ + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + return baseDao.getAgencyListByCustomerId(customerId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java index 074d917144..601d8110a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java @@ -21,7 +21,11 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.stats.FactArticlePublishedAgencyDailyDao; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collection; /** * 文章发布数量【机关】日统计表 @@ -29,10 +33,17 @@ import org.springframework.stereotype.Service; * @author generator generator@elink-cn.com * @since v1.0.0 2020-06-18 */ +@Slf4j @Service public class FactArticlePublishedAgencyDailyServiceImpl extends BaseServiceImpl implements FactArticlePublishedAgencyDailyService { - - + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deleteAndInsertBatch(String customerId, String dateId, Collection values) { + int i = baseDao.deleteByDateId(customerId, dateId); + log.debug("deleteAndInsertBatch delete customerId:{},rows:{}", customerId,i); + this.insertBatch(values, 100); + return true; + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java index 3a1c321c9c..e1aee5a20a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java @@ -40,5 +40,19 @@ public interface ArticleService extends BaseService { * @param publishDate * @return */ - List getAllPublishedCount(String customerId, Date publishDate); + List getAllDepartmentPublishedCount(String customerId, Date publishDate); + /** + * desc:根据客户id、发布时间 获取文章总数 + * @param customerId + * @param publishDate + * @return + */ + List getAllAgencyPublishedCount(String customerId, Date publishDate); + /** + * desc:根据客户id、发布时间 获取文章总数 + * @param customerId + * @param publishDate + * @return + */ + List getAllGridPublishedCount(String customerId, Date publishDate); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java index 27821e8a41..82166605ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java @@ -44,10 +44,26 @@ import java.util.List; public class ArticleServiceImpl extends BaseServiceImpl implements ArticleService { @Override - public List getAllPublishedCount(String customerId, Date publishDate) { + public List getAllDepartmentPublishedCount(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); + return baseDao.getAllPublishedCount(customerId,publishDate, ProjectConstant.PUBLISHER_TYPE_DEPT); + } + + @Override + public List getAllAgencyPublishedCount(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.PUBLISHER_TYPE_AGENCY); + } + + @Override + public List getAllGridPublishedCount(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.PUBLISHER_TYPE_GRID); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index d78bbb4eae..ad8ed78057 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -103,5 +103,17 @@ agency.CUSTOMER_ID, agency.PID + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml index 301fb3fe9f..ea4debe1dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml @@ -22,6 +22,9 @@ + + DELETE FROM fact_article_published_agency_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml index 69f1ddc5e3..ee9e94a49d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml @@ -34,14 +34,14 @@ ORG_ID AS agencyId, PUBLISHER_ID, count(ID) articleTotalCount, - sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) articlePublishedCount + sum( CASE STATUS_FLAG WHEN 'published' THEN 1 ELSE 0 END ) articlePublishedCount FROM - article_publish_range + article WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} - AND PUBLISH_TYPE = #{publishType,jdbcType=VARCHAR} - AND PUBLISH_DATE + AND PUBLISHER_TYPE = #{publisherType,jdbcType=VARCHAR} + AND PUBLISH_DATE GROUP BY CUSTOMER_ID, PUBLISHER_ID