|
|
|
|
@ -11,12 +11,15 @@ import org.jeecg.modules.ocr.entity.OcrIdentify;
|
|
|
|
|
import org.jeecg.modules.ocr.model.TaskModel;
|
|
|
|
|
import org.jeecg.modules.ocr.service.IOcrIdentifyService;
|
|
|
|
|
import org.jeecg.modules.ocr.service.impl.TaskService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.boot.ApplicationArguments;
|
|
|
|
|
import org.springframework.boot.ApplicationRunner;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@ -36,44 +39,47 @@ public class HandleTransInit implements ApplicationRunner {
|
|
|
|
|
TaskService taskService;
|
|
|
|
|
@Resource
|
|
|
|
|
IOcrIdentifyService ocrIdentifyService;
|
|
|
|
|
|
|
|
|
|
@Value("${enableHandleTask}")
|
|
|
|
|
private boolean enableHandleTask;
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 处理转账数据
|
|
|
|
|
*
|
|
|
|
|
* @param args
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Async
|
|
|
|
|
public void run(ApplicationArguments args) {
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(5000l);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
while (true) {
|
|
|
|
|
public void run(ApplicationArguments args) throws UnknownHostException {
|
|
|
|
|
if (enableHandleTask) {
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(10000l);
|
|
|
|
|
Thread.sleep(5000l);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
while (true) {
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(10000l);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.info("---------检测是否有任务...");
|
|
|
|
|
List<TaskModel> taskList = taskService.getTaskList();
|
|
|
|
|
if (taskList.size()==0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (TaskModel taskModel : taskList) {
|
|
|
|
|
//刷新redis,执行中
|
|
|
|
|
flushTask(taskModel.getTaskId(), 1);
|
|
|
|
|
//执行
|
|
|
|
|
executeTaskp(taskModel);
|
|
|
|
|
//刷新待运行任务
|
|
|
|
|
log.error("任务已执行:"+taskModel.getTaskId());
|
|
|
|
|
log.info("---------检测是否有任务...");
|
|
|
|
|
List<TaskModel> taskList = taskService.getTaskList();
|
|
|
|
|
if (taskList.size()==0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (TaskModel taskModel : taskList) {
|
|
|
|
|
//刷新redis,执行中
|
|
|
|
|
flushTask(taskModel.getTaskId(), 1);
|
|
|
|
|
//执行
|
|
|
|
|
executeTaskp(taskModel);
|
|
|
|
|
//刷新待运行任务
|
|
|
|
|
log.error("任务已执行:"+taskModel.getTaskId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|