Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
cad6c711
Commit
cad6c711
authored
Dec 07, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.代码整理
parent
50337b57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
27 deletions
+21
-27
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+21
-27
No files found.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
cad6c711
...
@@ -1662,39 +1662,33 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1662,39 +1662,33 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
publisher
.
publish
(
new
CheckRecordInsertEvent
(
this
,
dataDto
));
publisher
.
publish
(
new
CheckRecordInsertEvent
(
this
,
dataDto
));
}
}
private
void
saveMustData
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
PlanTask
>
planTasks
)
{
private
void
saveMustData
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
PlanTask
>
planTasks
)
{
// 保存es数据
// 保存es数据
List
<
CompletableFuture
<
Void
>>
futures
=
new
ArrayList
<>();
CompletableFuture
<
Void
>
future1
=
CompletableFuture
.
runAsync
(()
->
saveTasks
(
esTaskDetailDtos
),
asyncServiceExecutor
);
CompletableFuture
<
Void
>
future1
=
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
<
Void
>
future2
=
CompletableFuture
.
runAsync
(()
->
savePlanTasks
(
esPlanTaskListDtos
),
asyncServiceExecutor
);
try
{
esTaskDetail
.
saveAll
(
esTaskDetailDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
CompletableFuture
<
Void
>
future2
=
CompletableFuture
.
runAsync
(()
->
{
try
{
esPlanTaskList
.
saveAll
(
esPlanTaskListDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
// 更新统计数据表
// 更新统计数据表
CompletableFuture
<
Void
>
future3
=
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
<
Void
>
future3
=
CompletableFuture
.
runAsync
(()
->
updateStaticTable
(
planTasks
),
asyncServiceExecutor
);
try
{
CompletableFuture
<
Void
>
allOfFuture
=
CompletableFuture
.
allOf
(
future1
,
future2
,
future3
);
this
.
updateStaticTable
(
planTasks
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
futures
.
add
(
future1
);
futures
.
add
(
future2
);
futures
.
add
(
future3
);
CompletableFuture
<
Void
>
allOfFuture
=
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
]));
allOfFuture
.
join
();
allOfFuture
.
join
();
}
}
private
void
saveTasks
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
)
{
try
{
esTaskDetail
.
saveAll
(
esTaskDetailDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
private
void
savePlanTasks
(
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
)
{
try
{
esPlanTaskList
.
saveAll
(
esPlanTaskListDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
private
void
updateStaticTable
(
List
<
PlanTask
>
planTasks
)
{
private
void
updateStaticTable
(
List
<
PlanTask
>
planTasks
)
{
List
<
StaticTableUpdateDto
>
staticTableUpdateDtos
=
planTasks
.
stream
().
map
(
planTask
->
{
List
<
StaticTableUpdateDto
>
staticTableUpdateDtos
=
planTasks
.
stream
().
map
(
planTask
->
{
StaticTableUpdateDto
updateDto
=
new
StaticTableUpdateDto
();
StaticTableUpdateDto
updateDto
=
new
StaticTableUpdateDto
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment