2 changed files with 91 additions and 16 deletions
@ -0,0 +1,76 @@ |
|||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.elink.esua.epdc.dao.ScreenRecordDao; |
||||
|
import com.elink.esua.epdc.feign.AnalysisFeignClient; |
||||
|
import com.elink.esua.epdc.service.ScreenProjectDataMonthPushTask; |
||||
|
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("screenProjectDataPushMinuteTask") |
||||
|
public class ScreenProjectDataPushMinuteTaskImpl 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 < 11; 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); |
||||
|
// 010、中央区各类总数
|
||||
|
customerUsertotaldata(); |
||||
|
return 0; |
||||
|
} |
||||
|
}); |
||||
|
Integer isSuccess = 0; |
||||
|
try { |
||||
|
isSuccess = future.get(); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return isSuccess; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 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 + "|中央区各类总数>定时任务执行结束"); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue