10 changed files with 1166 additions and 5 deletions
@ -1 +1 @@ |
|||
Subproject commit cc0e5d4a31687b9224edc53d7b8d6414e7005d6a |
|||
Subproject commit 43f964b23834db67899f4dac0f97ab99d25e225a |
@ -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.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.ScreenRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 大屏增量同步记录表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Mapper |
|||
public interface ScreenRecordDao extends BaseDao<ScreenRecordEntity> { |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
/** |
|||
* 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.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 大屏增量同步记录表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_screen_record") |
|||
public class ScreenRecordEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 作业名称 |
|||
*/ |
|||
private String jobName; |
|||
|
|||
/** |
|||
* 统计时间 |
|||
*/ |
|||
private Date statisticsTime; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
/** |
|||
* 大屏基础信息统计上报 |
|||
* |
|||
* @Author:liuchuang |
|||
* @Date:2020/9/9 15:17 |
|||
*/ |
|||
public interface ScreenBasicDataPushTask { |
|||
|
|||
/** |
|||
* 大屏数据推送 |
|||
* |
|||
* @param param 入参 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 15:21 |
|||
*/ |
|||
void run(String param); |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
/** |
|||
* 大屏【事件/项目分析】信息统计上报 |
|||
* |
|||
* @Author: wangtong |
|||
* @Date: 2021/2/24 14:16 |
|||
*/ |
|||
public interface ScreenProjectDataMonthPushTask { |
|||
/** |
|||
* 大屏数据推送 |
|||
* |
|||
* @param param 入参 |
|||
* @return void |
|||
* @author wangtong |
|||
* @since 2021/2/24 14:16 |
|||
*/ |
|||
void run(String param); |
|||
} |
@ -0,0 +1,446 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.elink.esua.epdc.dto.ScreenJobBasicDataParamDTO; |
|||
import com.elink.esua.epdc.dto.screen.form.ScreenJobFormDTO; |
|||
import com.elink.esua.epdc.feign.AnalysisFeignClient; |
|||
import com.elink.esua.epdc.service.ScreenBasicDataPushTask; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.Callable; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
import java.util.concurrent.Future; |
|||
|
|||
/** |
|||
* 大屏基础信息统计上报 |
|||
* |
|||
* @Author:liuchuang |
|||
* @Date:2020/9/9 15:17 |
|||
*/ |
|||
@Component("screenBasicDataPushTask") |
|||
public class ScreenBasicDataPushTaskImpl implements ScreenBasicDataPushTask { |
|||
|
|||
private final Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
private static final ExecutorService service = Executors.newFixedThreadPool(100); |
|||
|
|||
@Autowired |
|||
private AnalysisFeignClient analysisFeignClient; |
|||
|
|||
@Override |
|||
public void run(String param) { |
|||
// 参数处理
|
|||
ScreenJobBasicDataParamDTO paramDto = new ScreenJobBasicDataParamDTO(); |
|||
if (StringUtils.isNotEmpty(param)) { |
|||
paramDto = JSONObject.parseObject(param, ScreenJobBasicDataParamDTO.class); |
|||
} |
|||
for(int i = 0 ; i < 20 ; i++){ |
|||
createThread(i, paramDto); |
|||
} |
|||
} |
|||
|
|||
public Integer createThread(Integer methodIndex, ScreenJobBasicDataParamDTO paramDto){ |
|||
Future<Integer> future = service.submit(new Callable<Integer>() { |
|||
@Override |
|||
public Integer call() throws Exception { |
|||
Thread.sleep(200); |
|||
if (methodIndex == 0) { |
|||
homePagePlatformSummary(); |
|||
} else if (methodIndex == 1){ |
|||
issueSummary(); |
|||
} else if (methodIndex == 2){ |
|||
issueTrend(paramDto.getIssueTrend()); |
|||
} else if (methodIndex == 3){ |
|||
userSummary(); |
|||
} else if (methodIndex == 4){ |
|||
volunteerHeartRank(paramDto.getVolunteerHeartRank()); |
|||
} else if (methodIndex == 5){ |
|||
userUserHeartRank(paramDto.getUserUserHeartRank()); |
|||
} else if (methodIndex == 6){ |
|||
actSummary(); |
|||
} else if (methodIndex == 7){ |
|||
actTrend(paramDto.getActTrend()); |
|||
} else if (methodIndex == 8){ |
|||
actVolunteerSummary(); |
|||
} else if (methodIndex == 9){ |
|||
projectSummary(); |
|||
} else if (methodIndex == 10){ |
|||
projectCategorySummary(); |
|||
} else if (methodIndex == 11){ |
|||
projectStatisticAnalysis(paramDto.getProjectStatisticAnalysis()); |
|||
} else if (methodIndex == 12){ |
|||
newsSummary(); |
|||
} else if (methodIndex == 13){ |
|||
newsTrend(paramDto.getNewsTrend()); |
|||
} else if (methodIndex == 14){ |
|||
newsHotRank(paramDto.getNewsHotRank()); |
|||
} else if (methodIndex == 15){ |
|||
newsCategoryAnalysis(); |
|||
} else if (methodIndex == 16){ |
|||
groupSummary(); |
|||
} else if (methodIndex == 17){ |
|||
groupDetail(); |
|||
} else if (methodIndex == 18){ |
|||
groupTopicTrend(paramDto.getGroupTopicTrend()); |
|||
} else if (methodIndex == 19){ |
|||
partyUserRankData(paramDto.getPartyUserRankData()); |
|||
} |
|||
return 0; |
|||
} |
|||
}); |
|||
Integer isSuccess = 0; |
|||
try { |
|||
isSuccess = future.get(); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
return isSuccess; |
|||
} |
|||
|
|||
/** |
|||
* 1、首页-平台各类总数上报 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 15:47 |
|||
*/ |
|||
public void homePagePlatformSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|首页-平台各类总数上报>定时任务开始执行"); |
|||
analysisFeignClient.homePagePlatformSummary(); |
|||
logger.info("<" + methodName + "|首页-平台各类总数上报>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 2、议题分析-各类总数 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void issueSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|议题分析-各类总数>定时任务开始执行"); |
|||
analysisFeignClient.issueSummary(); |
|||
logger.info("<" + methodName + "|议题分析-各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 3、议题分析-参与趋势 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void issueTrend(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|议题分析-参与趋势>定时任务开始执行"); |
|||
analysisFeignClient.issueTrend(formDto); |
|||
logger.info("<" + methodName + "|议题分析-参与趋势>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 4、用户分析-各类总数 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void userSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|用户分析-各类总数>定时任务开始执行"); |
|||
analysisFeignClient.userSummary(); |
|||
logger.info("<" + methodName + "|用户分析-各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 5、公益互助-志愿者公益时长排名 |
|||
* |
|||
* @param param 获取志愿者排行数量 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void volunteerHeartRank(String param) { |
|||
// 默认查100条
|
|||
int pageSize = 100; |
|||
if (StringUtils.isNotEmpty(param)) { |
|||
pageSize = Integer.parseInt(param); |
|||
} |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setPageSize(pageSize); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|公益互助-志愿者公益时长排名>定时任务开始执行"); |
|||
analysisFeignClient.volunteerHeartRank(formDto); |
|||
logger.info("<" + methodName + "|公益互助-志愿者公益时长排名>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 6、用户分析-用户趋势 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void userUserHeartRank(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|用户分析-用户趋势>定时任务开始执行"); |
|||
analysisFeignClient.userUserHeartRank(formDto); |
|||
logger.info("<" + methodName + "|用户分析-用户趋势>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 7、公益互助-活动各类总数 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void actSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|公益互助-活动各类总数>定时任务开始执行"); |
|||
analysisFeignClient.actSummary(); |
|||
logger.info("<" + methodName + "|公益互助-活动各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 8、公益互助-活动次数趋势 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void actTrend(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|公益互助-活动次数趋势>定时任务开始执行"); |
|||
analysisFeignClient.actTrend(formDto); |
|||
logger.info("<" + methodName + "|公益互助-活动次数趋势>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 9、公益互助-志愿者画像 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void actVolunteerSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|公益互助-志愿者画像>定时任务开始执行"); |
|||
analysisFeignClient.actVolunteerSummary(); |
|||
logger.info("<" + methodName + "|公益互助-志愿者画像>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 10、项目分析-各类总数 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void projectSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|项目分析-各类总数>定时任务开始执行"); |
|||
analysisFeignClient.projectSummary(); |
|||
logger.info("<" + methodName + "|项目分析-各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 11、项目分析-按分类统计 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void projectCategorySummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|项目分析-按分类统计>定时任务开始执行"); |
|||
analysisFeignClient.projectCategorySummary(); |
|||
logger.info("<" + methodName + "|项目分析-按分类统计>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 12、项目分析-满意度分析 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void projectStatisticAnalysis(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|项目分析-满意度分析>定时任务开始执行"); |
|||
analysisFeignClient.projectStatisticAnalysis(formDto); |
|||
logger.info("<" + methodName + "|项目分析-满意度分析>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 13、党建声音-新闻各类总数汇总 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void newsSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建声音-新闻各类总数汇总>定时任务开始执行"); |
|||
analysisFeignClient.newsSummary(); |
|||
logger.info("<" + methodName + "|党建声音-新闻各类总数汇总>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 14、党建声音-新闻阅读参与趋势 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void newsTrend(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建声音-新闻阅读参与趋势>定时任务开始执行"); |
|||
analysisFeignClient.newsTrend(formDto); |
|||
logger.info("<" + methodName + "|党建声音-新闻阅读参与趋势>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 15、党建声音-热度新闻排行 |
|||
* |
|||
* @param param 统计数量 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void newsHotRank(String param) { |
|||
// 默认查100条
|
|||
int pageSize = 100; |
|||
if (StringUtils.isNotEmpty(param)) { |
|||
pageSize = Integer.parseInt(param); |
|||
} |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setPageSize(pageSize); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建声音-热度新闻排行>定时任务开始执行"); |
|||
analysisFeignClient.newsHotRank(formDto); |
|||
logger.info("<" + methodName + "|党建声音-热度新闻排行>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 16、党建声音-新闻按类别统计 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void newsCategoryAnalysis() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建声音-新闻按类别统计>定时任务开始执行"); |
|||
analysisFeignClient.newsCategoryAnalysis(); |
|||
logger.info("<" + methodName + "|党建声音-新闻按类别统计>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 17、邻里党群-各类总数汇总 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void groupSummary() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|邻里党群-各类总数汇总>定时任务开始执行"); |
|||
analysisFeignClient.groupSummary(); |
|||
logger.info("<" + methodName + "|邻里党群-各类总数汇总>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 18、邻里党群-小组详情 |
|||
* |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void groupDetail() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|邻里党群-小组详情>定时任务开始执行"); |
|||
analysisFeignClient.groupDetail(); |
|||
logger.info("<" + methodName + "|邻里党群-小组详情>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 19、邻里党群-话题参与趋势 |
|||
* |
|||
* @param yearMonth 统计月份 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void groupTopicTrend(String yearMonth) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(yearMonth); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|邻里党群-话题参与趋势>定时任务开始执行"); |
|||
analysisFeignClient.groupTopicTrend(formDto); |
|||
logger.info("<" + methodName + "|邻里党群-话题参与趋势>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 09、党建引领|基层治理-居民(党员)积分排行榜 |
|||
* |
|||
* @param param 统计数量 |
|||
* @return void |
|||
* @author Liuchuang |
|||
* @since 2020/9/9 16:48 |
|||
*/ |
|||
public void partyUserRankData(String param) { |
|||
// 默认查100条
|
|||
int pageSize = 100; |
|||
if (StringUtils.isNotEmpty(param)) { |
|||
pageSize = Integer.parseInt(param); |
|||
} |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setPageSize(pageSize); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领|基层治理-居民(党员)积分排行榜>定时任务开始执行"); |
|||
analysisFeignClient.partyUserRankData(formDto); |
|||
logger.info("<" + methodName + "|党建引领|基层治理-居民(党员)积分排行榜>定时任务执行结束"); |
|||
} |
|||
} |
@ -0,0 +1,355 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.DateUtils; |
|||
import com.elink.esua.epdc.dao.ScreenRecordDao; |
|||
import com.elink.esua.epdc.dto.screen.form.ScreenProjectFormDTO; |
|||
import com.elink.esua.epdc.entity.ScreenRecordEntity; |
|||
import com.elink.esua.epdc.feign.AnalysisFeignClient; |
|||
import com.elink.esua.epdc.service.ScreenProjectDataMonthPushTask; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.concurrent.Callable; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
import java.util.concurrent.Future; |
|||
|
|||
/** |
|||
* @program: esua-epdc |
|||
* @description: 大屏【事件/项目分析】信息统计上报 |
|||
* @author: wangtong |
|||
* @create: 2021-02-24 13:48 |
|||
**/ |
|||
@Component("screenProjectDataPushDayTask") |
|||
public class ScreenProjectDataPushDayTaskImpl implements ScreenProjectDataMonthPushTask { |
|||
|
|||
private final Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
private static final ExecutorService service = Executors.newFixedThreadPool(100); |
|||
|
|||
@Autowired |
|||
private AnalysisFeignClient analysisFeignClient; |
|||
|
|||
@Autowired |
|||
private ScreenRecordDao screenRecordDao; |
|||
|
|||
@Override |
|||
public void run(String param) { |
|||
for(int i = 0 ; i < 14 ; i++){ |
|||
createThread(i); |
|||
} |
|||
} |
|||
|
|||
public Integer createThread(Integer methodIndex){ |
|||
Future<Integer> future = service.submit(new Callable<Integer>() { |
|||
@Override |
|||
public Integer call() throws Exception { |
|||
Thread.sleep(200); |
|||
if (methodIndex == 0) { |
|||
projectGridDaily(); |
|||
} else if (methodIndex == 1){ |
|||
projectOrgDaily(); |
|||
}else if (methodIndex == 2){ |
|||
uploadProjectInfo(); |
|||
} else if (methodIndex == 3){ |
|||
uploadProjectProcess(); |
|||
}else if (methodIndex == 4){ |
|||
//001、基层党建-党员基本情况
|
|||
customerCpcbasedata(); |
|||
}else if (methodIndex == 5){ |
|||
//002、党建引领-先锋模范数据
|
|||
customerPioneerdata(); |
|||
}else if (methodIndex == 6){ |
|||
//003、党建引领-党员联系群众数据
|
|||
customerPartylinkmassesdata(); |
|||
}else if (methodIndex == 7){ |
|||
//004、党建引领-先进排行榜单-先进支部排行
|
|||
customerOrgrankdata(); |
|||
}else if (methodIndex == 8){ |
|||
//005、党建引领|基层治理-居民(党员)积分排行榜
|
|||
customerPartyuserrankdata(); |
|||
}else if (methodIndex == 9){ |
|||
//006、基层治理-难点赌点项目上报
|
|||
customerDifficultydata(); |
|||
}else if (methodIndex == 10){ |
|||
//007、基层治理-公众参与
|
|||
customerUserjoin(); |
|||
}else if (methodIndex == 11){ |
|||
// 008、公众参与各类总数
|
|||
customerPublicpartitotaldata(); |
|||
}else if (methodIndex == 12){ |
|||
//009、基层治理-治理能力数据
|
|||
customerGovernrankdata(); |
|||
}else if (methodIndex == 13){ |
|||
// 010、中央区各类总数
|
|||
customerUsertotaldata(); |
|||
} |
|||
return 0; |
|||
} |
|||
}); |
|||
Integer isSuccess = 0; |
|||
try { |
|||
isSuccess = future.get(); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
return isSuccess; |
|||
} |
|||
/** |
|||
* @Description 项目信息上报 |
|||
* @Author songyunpeng |
|||
* @Date 2021/2/24 |
|||
* @Param [] |
|||
* @return void |
|||
**/ |
|||
private void uploadProjectInfo() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|项目信息上报>定时任务开始执行"); |
|||
//获取上次统计时间
|
|||
Map<String,Object> param = new HashMap<>(); |
|||
param.put("JOB_NAME","uploadProjectInfo"); |
|||
List<ScreenRecordEntity> screenRecordEntities = screenRecordDao.selectByMap(param); |
|||
ScreenRecordEntity screenRecordEntity = new ScreenRecordEntity(); |
|||
ScreenProjectFormDTO screenProjectFormDTO = new ScreenProjectFormDTO(); |
|||
if(screenRecordEntities==null || screenRecordEntities.size()==0){ |
|||
screenProjectFormDTO.setYearMonthDay("2020-01-01"); |
|||
}else { |
|||
screenRecordEntity = screenRecordEntities.get(0); |
|||
screenProjectFormDTO.setYearMonthDay(DateUtils.format(screenRecordEntity.getStatisticsTime(), DateUtils.DATE_PATTERN)); |
|||
} |
|||
//记录此次统计时间 并更新时间或者新增
|
|||
screenRecordEntity.setStatisticsTime(DateUtils.addDateDays(new Date(),-1)); |
|||
if(StringUtils.isNotBlank(screenRecordEntity.getId())){ |
|||
screenRecordDao.updateById(screenRecordEntity); |
|||
}else { |
|||
screenRecordEntity.setJobName("uploadProjectInfo"); |
|||
screenRecordDao.insert(screenRecordEntity); |
|||
} |
|||
analysisFeignClient.uploadProjectInfo(screenProjectFormDTO); |
|||
logger.info("<" + methodName + "|项目信息上报>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* @Description 项目处理流程信息上报 |
|||
* @Author songyunpeng |
|||
* @Date 2021/2/24 |
|||
* @Param [] |
|||
* @return void |
|||
**/ |
|||
private void uploadProjectProcess() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|项目处理流程信息上报>定时任务开始执行"); |
|||
//获取上次统计时间
|
|||
Map<String,Object> param = new HashMap<>(); |
|||
param.put("JOB_NAME","uploadProjectProcess"); |
|||
List<ScreenRecordEntity> screenRecordEntities = screenRecordDao.selectByMap(param); |
|||
ScreenRecordEntity screenRecordEntity = new ScreenRecordEntity(); |
|||
ScreenProjectFormDTO screenProjectFormDTO = new ScreenProjectFormDTO(); |
|||
if(screenRecordEntities==null || screenRecordEntities.size()==0){ |
|||
screenProjectFormDTO.setYearMonthDay("2020-01-01"); |
|||
}else { |
|||
screenRecordEntity = screenRecordEntities.get(0); |
|||
screenProjectFormDTO.setYearMonthDay(DateUtils.format(screenRecordEntity.getStatisticsTime(), DateUtils.DATE_PATTERN)); |
|||
} |
|||
//记录此次统计时间 并更新时间或者新增
|
|||
screenRecordEntity.setStatisticsTime(DateUtils.addDateDays(new Date(),-1)); |
|||
if(StringUtils.isNotBlank(screenRecordEntity.getId())){ |
|||
screenRecordDao.updateById(screenRecordEntity); |
|||
}else { |
|||
screenRecordEntity.setJobName("uploadProjectProcess"); |
|||
screenRecordDao.insert(screenRecordEntity); |
|||
} |
|||
analysisFeignClient.uploadProjectProcess(screenProjectFormDTO); |
|||
logger.info("<" + methodName + "|项目处理流程信息上报>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* @describe: 【事件/项目分析】网格内事件 |
|||
* @author wangtong |
|||
* @date 2021/2/24 13:57 |
|||
* @params [] |
|||
* @return void |
|||
*/ |
|||
private void projectGridDaily() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|【事件/项目分析】网格内事件>定时任务开始执行"); |
|||
|
|||
analysisFeignClient.projectGridDaily(); |
|||
logger.info("<" + methodName + "|【事件/项目分析】网格内事件>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* @describe: 【事件/项目分析】组织内事件 |
|||
* @author wangtong |
|||
* @date 2021/2/24 13:57 |
|||
* @params [] |
|||
* @return void |
|||
*/ |
|||
private void projectOrgDaily() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|事件/项目分析】组织内事件>定时任务开始执行"); |
|||
analysisFeignClient.projectOrgDaily(); |
|||
logger.info("<" + methodName + "|事件/项目分析】组织内事件>定时任务执行结束"); |
|||
} |
|||
/** |
|||
* 010、中央区各类总数 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerUsertotaldata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|中央区各类总数>定时任务开始执行"); |
|||
analysisFeignClient.usertotaldata(); |
|||
logger.info("<" + methodName + "|中央区各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 009、基层治理-治理能力数据 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerGovernrankdata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层治理-治理能力数据>定时任务开始执行"); |
|||
analysisFeignClient.governrankdata(); |
|||
logger.info("<" + methodName + "|基层治理-治理能力数据>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 008、公众参与各类总数 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerPublicpartitotaldata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|公众参与各类总数>定时任务开始执行"); |
|||
analysisFeignClient.publicpartitotaldata(); |
|||
logger.info("<" + methodName + "|公众参与各类总数>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 007、基层治理-公众参与 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerUserjoin() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层治理-公众参与>定时任务开始执行"); |
|||
analysisFeignClient.userjoin(); |
|||
logger.info("<" + methodName + "|基层治理-公众参与>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 006、基层治理-难点赌点项目上报 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerDifficultydata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层治理-难点赌点项目上报>定时任务开始执行"); |
|||
analysisFeignClient.difficultydata(); |
|||
logger.info("<" + methodName + "|基层治理-难点赌点项目上报>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 005、党建引领|基层治理-居民(党员)积分排行榜 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerPartyuserrankdata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领|基层治理-居民(党员)积分排行榜>定时任务开始执行"); |
|||
analysisFeignClient.partyuserrankdata(); |
|||
logger.info("<" + methodName + "|党建引领|基层治理-居民(党员)积分排行榜>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 004、党建引领-先进排行榜单-先进支部排行 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerOrgrankdata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领-先进排行榜单-先进支部排行>定时任务开始执行"); |
|||
analysisFeignClient.orgrankdata(); |
|||
logger.info("<" + methodName + "|党建引领-先进排行榜单-先进支部排行>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 003、党建引领-党员联系群众数据 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerPartylinkmassesdata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领-党员联系群众数据>定时任务开始执行"); |
|||
analysisFeignClient.partylinkmassesdata(); |
|||
logger.info("<" + methodName + "|党建引领-党员联系群众数据>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 002、党建引领-先锋模范数据 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerPioneerdata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领-先锋模范数据>定时任务开始执行"); |
|||
analysisFeignClient.pioneerdata(); |
|||
logger.info("<" + methodName + "|党建引领-先锋模范数据>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 001、基层党建-党员基本情况 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
*/ |
|||
private void customerCpcbasedata() { |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层党建-党员基本情况>定时任务开始执行"); |
|||
analysisFeignClient.cpcbasedata(); |
|||
logger.info("<" + methodName + "|基层党建-党员基本情况>定时任务执行结束"); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue