提交 11bca1fd authored 作者: ljj's avatar ljj

fix:优化启动速度

上级 df86e6a8
......@@ -15,10 +15,12 @@ import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.subject.domin.Task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
/**
......@@ -42,7 +44,10 @@ public class ConfirmCheckTask implements CommandLineRunner {
public Map<Integer, List<DeviceInLibVo>> hisInLib = new HashMap<>();;
public Map<Integer, List<DeviceNotInLibVo>> hisNotInLib = new HashMap<>();;
public Map<Integer, List<DeviceNotInLibVo>> hisNotInLib = new HashMap<>();
@Autowired
@Qualifier("taskExecutor")
private Executor executor;
@Override
public void run(String... args) {
......@@ -56,9 +61,9 @@ public class ConfirmCheckTask implements CommandLineRunner {
List<Task> tasks = taskDao.findAllByBusinessTypeAndBillStatusNotIn(8, Arrays.asList(140, 160));
for (Task task : tasks) {
extracted(task.getBillId());
for (Task task : tasks) {
executor.execute(() -> extracted(task.getBillId()));
}
log.info("[check] 加载账单快照用时:{}ms", System.currentTimeMillis() - startTime);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论