Browse Source

配置gov_voice数据库

master
jianjun 5 years ago
parent
commit
99ce197cc2
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  3. 38
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java
  4. 12
      epmet-module/data-statistical/data-statistical-server/pom.xml
  5. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/PublicityController.java
  6. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java
  7. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java
  8. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java
  9. 125
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleEntity.java
  10. 85
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java
  11. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java
  13. 68
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  14. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java
  15. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java
  16. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java
  17. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java
  18. 47
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java
  19. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java
  20. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  21. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml
  22. 34
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml
  23. 40
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.1.130:3306/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://192.168.1.130:3306/epmet_gov_voice?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet_dba
password: EpmEt-dbA-UsEr
#oracle配置

1
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java

@ -6,5 +6,6 @@ public interface DataSourceConstant {
String STATS = "stats";
String GOV_ISSUE = "govIssue";
String GOV_PROJECT = "govProject";
String GOV_VOICE = "govVoice";
}

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

@ -0,0 +1,38 @@
package com.epmet.dto.stats;
/**
* @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 ArticleGridPublishedSummaryDTO implements Serializable {
private static final long serialVersionUID = 6755654148306711602L;
/**
* 客户id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 发布文章总数
*/
private Integer publishedCount;
/**
* 状态为发布中的文章总数
*/
private Integer publishingCount;
}

12
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -122,6 +122,12 @@
<datasource.druid.project.username>epmet_gov_project_user</datasource.druid.project.username>
<datasource.druid.project.password>EpmEt-db-UsEr</datasource.druid.project.password>
<datasource.druid.voice.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_gov_voice?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.voice.url>
<datasource.druid.voice.username>epmet_gov_voice_user</datasource.druid.voice.username>
<datasource.druid.voice.password>EpmEt-db-UsEr</datasource.druid.voice.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host>
@ -180,6 +186,12 @@
<datasource.druid.project.username>epmet_gov_project_user</datasource.druid.project.username>
<datasource.druid.project.password>EpmEt-db-UsEr</datasource.druid.project.password>
<datasource.druid.voice.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_gov_voice?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.voice.url>
<datasource.druid.voice.username>epmet</datasource.druid.voice.username>
<datasource.druid.voice.password>elink@833066</datasource.druid.voice.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/PublicityController.java

@ -0,0 +1,29 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.StatsDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.ExecutorService;
/**
* desc:宣传能力controller
*/
@RequestMapping("publicity")
@RestController
public class PublicityController {
@Autowired
private StatsDemoService demoService;
@Autowired
private ExecutorService executorService;
@PostMapping(value = "publicitySummaryStatsjob")
public Result<Boolean> publicitySummaryStatsjob(){
return null;
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java

@ -21,6 +21,8 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.DimCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 客户维度
*
@ -30,4 +32,15 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DimCustomerDao extends BaseDao<DimCustomerEntity> {
/**
* desc: 分页获取客户id
*
* @param pageNo
* @param offset
* return: List<String>
* @date: 2020/6/17 16:33
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
List<String> selectCustomerIdPage(Integer pageNo, int offset);
}

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

@ -0,0 +1,33 @@
/**
* 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.entity.voice.ArticleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 文章表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Mapper
public interface ArticleDao extends BaseDao<ArticleEntity> {
}

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

@ -0,0 +1,46 @@
/**
* 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.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticlePublishRangeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Mapper
public interface ArticlePublishRangeDao extends BaseDao<ArticlePublishRangeEntity> {
/**
* desc:查询网格发布文章总数及状态为发布中的文章总数
*
* @param customerId
* @param createDate
* @return
*/
List<ArticleGridPublishedSummaryDTO> selectByCreatedDate(@Param("customerId") String customerId, @Param("createDate") Date createDate);
}

125
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleEntity.java

@ -0,0 +1,125 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.voice;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 文章表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("article")
public class ArticleEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 草稿ID
*/
private String draftId;
/**
* 文章标题
*/
private String title;
/**
* 文章内容 精简内容
*/
private String previewContent;
/**
* 是否置顶 1是0否
*/
private Integer isTop;
/**
* 发布范围描述 所有发布范围集合顿号隔开
*/
private String publishRangeDesc;
/**
* 发布单位ID
*/
private String publisherId;
/**
* 发布单位名称
*/
private String publisherName;
/**
* 发布单位类型 机关:agency部门department网格grid
*/
private String publisherType;
/**
* 发布时间
*/
private Date publishDate;
/**
* 发布状态 已发布:published已下线offline
*/
private String statusFlag;
/**
* 下线时间
*/
private Date offLineTime;
/**
* 文章标签串 竖杠分割的标签名称
*/
private String tags;
/**
* 组织ID
*/
private String orgId;
/**
* 组织ID路径 eg字段为def:abc
*/
private String orgIdPath;
/**
* 网格ID 数据权限使用
*/
private String gridId;
/**
* 部门ID 数据权限使用
*/
private String departmentId;
}

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

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.voice;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("article_publish_range")
public class ArticlePublishRangeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 文章ID
*/
private String articleId;
/**
* 网格ID
*/
private String gridId;
/**
* 组织-网格名称
*/
private String agencyGridName;
/**
* 组织ID
*/
private String agencyId;
/**
* 所有上级组织机构ID 以英文:隔开
*/
private String pids;
/**
* 所有上级名称 以横杠隔开
*/
private String allParentName;
/**
* 下线时间
*/
private Date offLineTime;
/**
* 发布状态 已发布:published;已下线offline
*/
private String publishStatus;
}

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

@ -0,0 +1,15 @@
package com.epmet.service;
public interface StatsPublicityService {
/**
* desc: 统计宣传能力的汇总信息
*
* return:
* @date: 2020/6/17 16:11
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
Boolean publicitySummary();
}

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

@ -28,6 +28,7 @@ public class StatsDemoServiceImpl implements StatsDemoService {
@Autowired
private DemoDataStatsService demoDataStatsService;
@Override
public void testList() {
List<CustomerAgencyEntity> agencies = demoGovOrgService.listAllEntities();
List<IssueEntity> issues = demoIssueService.listAllEntities();
@ -36,6 +37,7 @@ public class StatsDemoServiceImpl implements StatsDemoService {
//该service不加事务
//@Transactional(rollbackFor = Exception.class)
@Override
public void testTx() {
demoDataStatsService.testTx();
}

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

@ -0,0 +1,68 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.service.StatsPublicityService;
import com.epmet.service.stats.*;
import com.epmet.service.voice.ArticlePublishRangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
/**
* desc: 宣传能力数据统计 service
*
* @date: 2020/6/17 16:08
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
@Service
public class StatsPublicityServiceImpl implements StatsPublicityService {
@Autowired
private DimAgencyService dimAgencyService;
@Autowired
private DimDateService dimDateService;
@Autowired
private DimWeekService dimWeekService;
@Autowired
private DimMonthService dimMonthService;
@Autowired
private DimQuarterService dimQuarterService;
@Autowired
private DimYearService dimYearService;
@Autowired
private DimCustomerService dimCustomerService;
@Autowired
private ArticlePublishRangeService articlePublishRangeService;
@Override
public Boolean publicitySummary() {
int pageNo = 1;
int pageSize = 100;
List<String> customerIdList = null;
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo, (pageNo - 1) * pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
customerIdList.forEach(customerId -> {
});
}
} while (!CollectionUtils.isEmpty(customerIdList) || customerIdList.size() >= pageSize);
return null;
}
private String statsPublishArticle(String customerId, Date statsDate) {
//1.先查询昨天的 有没有数据 有则 昨日发布文章总数 = 昨日的发布文章数增量 + 统计表中已有的昨日的网格总数 ;
// 否则 昨日发布文章总数 = 发布范围表中计算所有发布文章总数
List<ArticleGridPublishedSummaryDTO> articleCount = articlePublishRangeService.selectByCreatedDate(customerId, statsDate == null ? DateUtils.addDateDays(new Date(), -1) : statsDate);
return null;
}
}

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

@ -92,4 +92,16 @@ public interface DimCustomerService extends BaseService<DimCustomerEntity> {
* @date 2020-06-16
*/
void delete(String[] ids);
/**
* desc: 分页获取 客户id
*
* @param pageNo
* @param pageSize
* return: List<String>
* @date: 2020/6/17 16:26
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
List<String> selectCustomerIdPage(Integer pageNo, Integer pageSize);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java

@ -20,15 +20,17 @@ 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.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;
import com.epmet.dao.stats.DimCustomerDao;
import com.epmet.dto.stats.DimCustomerDTO;
import com.epmet.entity.stats.DimCustomerEntity;
import com.epmet.service.stats.DimCustomerService;
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;
@ -43,6 +45,7 @@ import java.util.Map;
* @since v1.0.0 2020-06-16
*/
@Service
@Slf4j
public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimCustomerEntity> implements DimCustomerService {
@Override
@ -97,4 +100,13 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public List<String> selectCustomerIdPage(Integer pageNo, Integer pageSize) {
if (pageNo ==null || pageNo <1 || pageSize == null || pageSize < 0){
log.error("selectCustomerIdPage param error,pageNo:{},pageSize:{}",pageNo,pageSize);
throw new RenException(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getCode(),EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getMsg());
}
return baseDao.selectCustomerIdPage(pageNo,(pageNo-1)*pageSize);
}
}

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

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

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

@ -0,0 +1,33 @@
/**
* 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.entity.voice.ArticleEntity;
/**
* desc: 数据统计文章service
*
* return:
* @date: 2020/6/17 15:28
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
public interface ArticleService extends BaseService<ArticleEntity> {
}

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

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.voice.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.voice.ArticlePublishRangeDao;
import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO;
import com.epmet.entity.voice.ArticlePublishRangeEntity;
import com.epmet.service.voice.ArticlePublishRangeService;
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
*/
@Service
@DataSource(DataSourceConstant.GOV_VOICE)
public class ArticlePublishRangeServiceImpl extends BaseServiceImpl<ArticlePublishRangeDao, ArticlePublishRangeEntity> implements ArticlePublishRangeService {
@Override
public List<ArticleGridPublishedSummaryDTO> selectByCreatedDate(String customerId, Date createDate) {
return baseDao.selectByCreatedDate(customerId,createDate);
}
}

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

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.voice.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.voice.ArticleDao;
import com.epmet.entity.voice.ArticleEntity;
import com.epmet.service.voice.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 项目表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-05-11
*/
@Service
@DataSource(DataSourceConstant.GOV_VOICE)
public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntity> implements ArticleService {
@Autowired
private ArticleDao articleDao;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml

@ -135,6 +135,11 @@ dynamic:
url: @datasource.druid.project.url@
username: @datasource.druid.project.username@
password: @datasource.druid.project.password@
govVoice:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.voice.url@
username: @datasource.druid.voice.username@
password: @datasource.druid.voice.password@
thread:
# 线程池配置

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

@ -4,6 +4,7 @@
<mapper namespace="com.epmet.dao.stats.DimCustomerDao">
<select id="selectCustomerIdPage" resultType="java.lang.String">
select ID FROM dim_customer WHERE DEL_FLAG = '0'
</select>
</mapper>

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

@ -0,0 +1,34 @@
<?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.ArticleDao">
<resultMap type="com.epmet.entity.voice.ArticleEntity" id="articleMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="draftId" column="DRAFT_ID"/>
<result property="title" column="TITLE"/>
<result property="previewContent" column="PREVIEW_CONTENT"/>
<result property="isTop" column="IS_TOP"/>
<result property="publishRangeDesc" column="PUBLISH_RANGE_DESC"/>
<result property="publisherId" column="PUBLISHER_ID"/>
<result property="publisherName" column="PUBLISHER_NAME"/>
<result property="publisherType" column="PUBLISHER_TYPE"/>
<result property="publishDate" column="PUBLISH_DATE"/>
<result property="statusFlag" column="STATUS_FLAG"/>
<result property="offLineTime" column="OFF_LINE_TIME"/>
<result property="tags" column="TAGS"/>
<result property="orgId" column="ORG_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="gridId" column="GRID_ID"/>
<result property="departmentId" column="DEPARTMENT_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>
</mapper>

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

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.voice.ArticlePublishRangeDao">
<resultMap type="com.epmet.entity.voice.ArticlePublishRangeEntity" id="articlePublishRangeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="articleId" column="ARTICLE_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyGridName" column="AGENCY_GRID_NAME"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="allParentName" column="ALL_PARENT_NAME"/>
<result property="offLineTime" column="OFF_LINE_TIME"/>
<result property="publishStatus" column="PUBLISH_STATUS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectByCreatedDate" resultType="com.epmet.dto.stats.ArticleGridPublishedSummaryDTO">
SELECT
GRID_ID,
count(ID) publishedCount,
sum( CASE PUBLISH_STATUS WHEN 'published' THEN 1 ELSE 0 END ) publishingCount
FROM
article_publish_range
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and
CREATED_TIME <![CDATA[ <#{createDate,jdbcType=TIMESTAMP}]]>
GROUP BY
CUSTOMER_ID,
GRID_ID
</select>
</mapper>
Loading…
Cancel
Save