提交 054fd154 authored 作者: Matrix's avatar Matrix

[核查模块] d增加缓存注解

上级 f6ba2014
......@@ -42,6 +42,7 @@ public class CacheLibraryServiceImpl implements DeviceLibraryCacheService {
* @return key = 装备主键id , Value = {@link DeviceLibrary}
*/
@Override
@Cacheable(key = "'device'")
public Map<Integer, DeviceLibrary> getDevicesMap() {
return deviceLibraryDao.findAll().stream()
.collect(Collectors.toMap(DeviceLibrary::getId, Function.identity()));
......
......@@ -317,15 +317,15 @@ public class TaskServiceImpl implements TaskService {
@ExceptionHandler(Exception.class)
@Log
public TaskBto start(TaskBto taskBto) {
Task task = taskDao.save(taskBto.toDo());
Task task = taskDao.saveAndFlush(taskBto.toDo());
myWebSocket.sendMessage1();
Task task1 = taskDao.findById(task.getId()).get();
CompletableFuture.runAsync(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Task task1 = taskDao.findById(task.getId()).get();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(task1));
String recordId = bcText.getData().getRecordID();
task1.setRecordId(recordId);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论