|
|
@ -1,24 +1,33 @@ |
|
|
|
package com.epmet.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
|
|
|
import com.epmet.dto.extract.form.ExtractScreenFormDTO; |
|
|
|
import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.concurrent.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zxc |
|
|
|
* @DateTime 2020/9/24 9:42 上午 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@RestController |
|
|
|
@RequestMapping("screenextract") |
|
|
|
public class ScreenExtractDailyController { |
|
|
|
|
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("ScreenExtractDailyController-pool-%d").build(); |
|
|
|
ExecutorService threadPool = new ThreadPoolExecutor(1, 1, |
|
|
|
10L, TimeUnit.MINUTES, |
|
|
|
new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); |
|
|
|
@Autowired |
|
|
|
private ScreenExtractService screenExtractService; |
|
|
|
|
|
|
@ -28,10 +37,17 @@ public class ScreenExtractDailyController { |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/24 10:15 上午 |
|
|
|
*/ |
|
|
|
@Async |
|
|
|
@PostMapping("extractdailyall") |
|
|
|
public Result screenExtractDaily(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { |
|
|
|
screenExtractService.extractDailyAll(extractOriginFormDTO); |
|
|
|
threadPool.submit(() -> { |
|
|
|
log.info("screenExtractDaily start,param:{}", JSON.toJSONString(extractOriginFormDTO)); |
|
|
|
try { |
|
|
|
screenExtractService.extractDailyAll(extractOriginFormDTO); |
|
|
|
log.info("screenExtractDaily end"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("screenExtractDaily exception", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|