3 changed files with 170 additions and 2 deletions
@ -0,0 +1,168 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.elink.esua.epdc.dto.ScreenJobMonthDataParamDTO; |
|||
import com.elink.esua.epdc.dto.screen.form.ScreenJobFormDTO; |
|||
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.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("screenProjectDataPushMonthTask") |
|||
public class ScreenProjectDataPushMonthTaskImpl implements ScreenProjectDataMonthPushTask { |
|||
|
|||
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) { |
|||
// 参数处理
|
|||
ScreenJobMonthDataParamDTO paramDto = new ScreenJobMonthDataParamDTO(); |
|||
if (StringUtils.isNotEmpty(param)) { |
|||
paramDto = JSONObject.parseObject(param, ScreenJobMonthDataParamDTO.class); |
|||
} |
|||
for(int i = 0 ; i < 5 ; i++){ |
|||
createThread(i,paramDto); |
|||
} |
|||
} |
|||
|
|||
public Integer createThread(Integer methodIndex,ScreenJobMonthDataParamDTO paramDto){ |
|||
Future<Integer> future = service.submit(new Callable<Integer>() { |
|||
@Override |
|||
public Integer call() throws Exception { |
|||
Thread.sleep(200); |
|||
if (methodIndex == 0) { |
|||
quantityGridMonthly(paramDto.getGridMonthDataMonthId()); |
|||
} else if (methodIndex == 1){ |
|||
quantityOrgMonthly(paramDto.getOrgMonthDataMonthId()); |
|||
}else if (methodIndex == 2){ |
|||
//004、党建引领-先进排行榜单-先进支部排行 --
|
|||
customerOrgrankdata(paramDto.getCustomerOrgRankDataMonthId()); |
|||
}else if (methodIndex == 3){ |
|||
//007、基层治理-公众参与 --
|
|||
customerUserjoin(paramDto.getCustomerUserJoinMonthId()); |
|||
}else if (methodIndex == 4){ |
|||
//009、基层治理-治理能力数据 --
|
|||
customerGovernrankdata(paramDto.getCustomerGovernRankData()); |
|||
} |
|||
return 0; |
|||
} |
|||
}); |
|||
Integer isSuccess = 0; |
|||
try { |
|||
isSuccess = future.get(); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
return isSuccess; |
|||
} |
|||
|
|||
/** |
|||
* @describe: 【事件/项目分析】网格内月度数量统计 |
|||
* @author wangtong |
|||
* @date 2021/2/24 13:57 |
|||
* @params [] |
|||
* @return void |
|||
* @param gridMonthDataMonthId |
|||
*/ |
|||
private void quantityGridMonthly(String gridMonthDataMonthId) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(gridMonthDataMonthId); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|【事件/项目分析】网格内月度数量统计>定时任务开始执行"); |
|||
analysisFeignClient.quantityGridMonthly(formDto); |
|||
logger.info("<" + methodName + "|【事件/项目分析】网格内月度数量统计>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* @describe: 【事件/项目分析】组织内月度数量统计 |
|||
* @author wangtong |
|||
* @date 2021/2/24 13:57 |
|||
* @params [] |
|||
* @return void |
|||
* @param orgMonthDataMonthId |
|||
*/ |
|||
private void quantityOrgMonthly(String orgMonthDataMonthId) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(orgMonthDataMonthId); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|事件/项目分析】组织内月度数量统计>定时任务开始执行"); |
|||
analysisFeignClient.quantityOrgMonthly(formDto); |
|||
logger.info("<" + methodName + "|事件/项目分析】组织内月度数量统计>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 004、党建引领-先进排行榜单-先进支部排行 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
* @param customerOrgRankDataMonthId |
|||
*/ |
|||
private void customerOrgrankdata(String customerOrgRankDataMonthId) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(customerOrgRankDataMonthId); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|党建引领-先进排行榜单-先进支部排行>定时任务开始执行"); |
|||
analysisFeignClient.orgrankdata(formDto); |
|||
logger.info("<" + methodName + "|党建引领-先进排行榜单-先进支部排行>定时任务执行结束"); |
|||
} |
|||
|
|||
/** |
|||
* 007、基层治理-公众参与 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
* @param customerUserJoinMonthId |
|||
*/ |
|||
private void customerUserjoin(String customerUserJoinMonthId) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(customerUserJoinMonthId); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层治理-公众参与>定时任务开始执行"); |
|||
analysisFeignClient.userjoin(formDto); |
|||
logger.info("<" + methodName + "|基层治理-公众参与>定时任务执行结束"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 009、基层治理-治理能力数据 |
|||
* |
|||
* @return void |
|||
* @author WK |
|||
* @since 2020/9/17 14:01 |
|||
* @param customerGovernRankData |
|||
*/ |
|||
private void customerGovernrankdata(String customerGovernRankData) { |
|||
ScreenJobFormDTO formDto = new ScreenJobFormDTO(); |
|||
formDto.setYearMonth(customerGovernRankData); |
|||
// 方法名
|
|||
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); |
|||
logger.info("<" + methodName + "|基层治理-治理能力数据>定时任务开始执行"); |
|||
analysisFeignClient.governrankdata(formDto); |
|||
logger.info("<" + methodName + "|基层治理-治理能力数据>定时任务执行结束"); |
|||
} |
|||
} |
Loading…
Reference in new issue