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
e8dd7310
Commit
e8dd7310
authored
Dec 11, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.立即刷新
parent
c53d8586
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
ESPlanTaskListDto.java
...com/yeejoin/amos/patrol/dao/entity/ESPlanTaskListDto.java
+4
-0
PlanTaskDetail.java
...va/com/yeejoin/amos/patrol/dao/entity/PlanTaskDetail.java
+11
-0
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+27
-4
No files found.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/ESPlanTaskListDto.java
View file @
e8dd7310
...
...
@@ -24,8 +24,12 @@ public class ESPlanTaskListDto {
@Id
private
String
id
;
@Field
(
type
=
FieldType
.
Text
)
private
String
planTaskId
;
@Field
(
type
=
FieldType
.
Text
)
private
String
orgCode
;
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/PlanTaskDetail.java
View file @
e8dd7310
...
...
@@ -35,12 +35,23 @@ public class PlanTaskDetail extends BasicEntity {
@Column
(
name
=
"executor_id"
)
private
String
executorId
;
@Transient
public
String
getName
()
{
return
name
;
}
@Transient
public
String
getPointNo
()
{
return
pointNo
;
}
/**
* 点名称
*/
@Column
(
name
=
"name"
)
private
String
name
;
/**
* 点编号
*/
...
...
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 @
e8dd7310
...
...
@@ -61,6 +61,8 @@ import org.elasticsearch.action.bulk.BulkRequest;
import
org.elasticsearch.action.index.IndexRequest
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.elasticsearch.action.update.UpdateRequest
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.common.xcontent.XContentType
;
...
...
@@ -1028,6 +1030,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
ESPlanTaskListDto
esPlanTaskListDto
=
JSONObject
.
parseObject
(
toJSONString
(
planTask
),
ESPlanTaskListDto
.
class
);
esPlanTaskListDto
.
setPlanTaskId
(
String
.
valueOf
(
planTask
.
getId
()));
esPlanTaskListDto
.
setId
(
String
.
valueOf
(
planTask
.
getId
()));
esPlanTaskListDto
.
setPlanId
(
String
.
valueOf
(
plan
.
getId
()));
esPlanTaskListDto
.
setTaskName
(
plan
.
getName
());
esPlanTaskListDto
.
setType
(
planType
);
...
...
@@ -1811,7 +1814,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private
void
saveMustData
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
PlanTask
>
planTasks
)
{
// 保存es数据
CompletableFuture
<
Void
>
future1
=
CompletableFuture
.
runAsync
(()
->
save
Task
s
(
esTaskDetailDtos
),
asyncServiceExecutor
);
CompletableFuture
<
Void
>
future1
=
CompletableFuture
.
runAsync
(()
->
save
PlanTaskDetail
s
(
esTaskDetailDtos
),
asyncServiceExecutor
);
CompletableFuture
<
Void
>
future2
=
CompletableFuture
.
runAsync
(()
->
savePlanTasks
(
esPlanTaskListDtos
),
asyncServiceExecutor
);
// 更新统计数据表
CompletableFuture
<
Void
>
future3
=
CompletableFuture
.
runAsync
(()
->
updateStaticTable
(
planTasks
),
asyncServiceExecutor
);
...
...
@@ -1819,11 +1822,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
allOfFuture
.
join
();
}
private
void
save
Task
s
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
)
{
private
void
save
PlanTaskDetail
s
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
)
{
try
{
List
<
EsEntity
<
ESTaskDetailDto
>>
batchList
=
esTaskDetailDtos
.
stream
()
.
map
(
item
->
new
EsEntity
<>(
item
.
getId
().
toString
(),
item
)).
collect
(
Collectors
.
toList
());
this
.
insert
Batch
(
"web_app_task_detail"
,
batchList
);
this
.
update
Batch
(
"web_app_task_detail"
,
batchList
);
// esTaskDetail.saveAll(esTaskDetailDtos);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -1848,12 +1851,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
/**
* Description: 批量修改数据
*
* @param index index
* @param list 更新列表
* @author LiuLin
*/
public
<
T
>
void
updateBatch
(
String
index
,
List
<
EsEntity
<
T
>>
list
)
{
BulkRequest
request
=
new
BulkRequest
();
list
.
forEach
(
item
->
request
.
add
(
new
UpdateRequest
(
index
,
item
.
getId
())
.
doc
(
JSON
.
toJSONString
(
item
.
getData
()),
XContentType
.
JSON
)));
try
{
request
.
setRefreshPolicy
(
WriteRequest
.
RefreshPolicy
.
IMMEDIATE
);
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
list
.
forEach
(
s
->
log
.
info
(
"===========索引:【{}】,主键:【{}】修改成功"
,
index
,
s
.
getId
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"索引:[{}]"
,
index
,
e
);
}
}
private
void
savePlanTasks
(
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
)
{
try
{
// esPlanTaskList.saveAll(esPlanTaskListDtos);
List
<
EsEntity
<
ESPlanTaskListDto
>>
batchList
=
esPlanTaskListDtos
.
stream
()
.
map
(
item
->
new
EsEntity
<>(
item
.
getPlanTaskId
(),
item
)).
collect
(
Collectors
.
toList
());
this
.
insert
Batch
(
"web_app_plan_task_list"
,
batchList
);
this
.
update
Batch
(
"web_app_plan_task_list"
,
batchList
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
...
...
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