Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
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
shenjunjie
brandkbs2
Commits
803cb7f0
Commit
803cb7f0
authored
Sep 25, 2024
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
原发溯源-发布节点调整
parent
b691c753
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+28
-4
No files found.
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
803cb7f0
...
@@ -1011,7 +1011,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1011,7 +1011,8 @@ public class MarkDataServiceImpl implements MarkDataService {
map
.
merge
(
title
,
jsonObject
,
(
v1
,
v2
)
->
{
map
.
merge
(
title
,
jsonObject
,
(
v1
,
v2
)
->
{
v1
.
put
(
"num"
,
v1
.
getLongValue
(
"num"
)
+
v2
.
getLongValue
(
"num"
));
v1
.
put
(
"num"
,
v1
.
getLongValue
(
"num"
)
+
v2
.
getLongValue
(
"num"
));
v1
.
put
(
"sourceCount"
,
v1
.
getIntValue
(
"sourceCount"
)
+
v2
.
getIntValue
(
"sourceCount"
));
v1
.
put
(
"sourceCount"
,
v1
.
getIntValue
(
"sourceCount"
)
+
v2
.
getIntValue
(
"sourceCount"
));
v1
.
put
(
"sources"
,
v1
.
getJSONArray
(
"sources"
).
addAll
(
v2
.
getJSONArray
(
"sources"
)));
v1
.
getJSONArray
(
"sources"
).
addAll
(
v2
.
getJSONArray
(
"sources"
));
v1
.
put
(
"sources"
,
v1
.
getJSONArray
(
"sources"
));
return
v1
;
return
v1
;
});
});
}
}
...
@@ -3857,8 +3858,26 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -3857,8 +3858,26 @@ public class MarkDataServiceImpl implements MarkDataService {
AggregationBuilders
.
dateHistogram
(
"timeAgg"
).
field
(
"time"
).
calendarInterval
(
DateHistogramInterval
.
DAY
).
offset
(
"16h"
);
AggregationBuilders
.
dateHistogram
(
"timeAgg"
).
field
(
"time"
).
calendarInterval
(
DateHistogramInterval
.
DAY
).
offset
(
"16h"
);
TermsAggregationBuilder
sourceAggregationBuilder
=
AggregationBuilders
.
terms
(
"sourceAgg"
).
field
(
"source"
).
size
(
10000
);
TermsAggregationBuilder
sourceAggregationBuilder
=
AggregationBuilders
.
terms
(
"sourceAgg"
).
field
(
"source"
).
size
(
10000
);
// response
// response
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
SearchResponse
searchResponse
;
daysAggregationBuilder
.
subAggregation
(
sourceAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
try
{
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
daysAggregationBuilder
.
subAggregation
(
sourceAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
}
catch
(
ElasticsearchStatusException
e
){
Long
startTime
=
dto
.
getStartTime
();
Long
endTime
=
dto
.
getEndTime
();
Long
midTime
=
startTime
+
(
endTime
-
startTime
)
/
2
;
if
(
midTime
-
startTime
<
Constant
.
ONE_DAY
||
endTime
-
midTime
<
Constant
.
ONE_DAY
){
log
.
info
(
"{}-getWholeSearchArticlePoint分割时间至一天bucket仍超出上限"
,
JSONObject
.
toJSONString
(
dto
));
return
jsonObjects
;
}
dto
.
setStartTime
(
startTime
);
dto
.
setEndTime
(
midTime
);
jsonObjects
.
addAll
(
getWholeSearchArticlePoint
(
dto
));
dto
.
setStartTime
(
midTime
);
dto
.
setEndTime
(
endTime
);
jsonObjects
.
addAll
(
getWholeSearchArticlePoint
(
dto
));
return
jsonObjects
;
}
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
ParsedDateHistogram
teamAgg
=
(
ParsedDateHistogram
)
aggMap
.
get
(
"timeAgg"
);
ParsedDateHistogram
teamAgg
=
(
ParsedDateHistogram
)
aggMap
.
get
(
"timeAgg"
);
List
<?
extends
Histogram
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
List
<?
extends
Histogram
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
...
@@ -4331,7 +4350,12 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -4331,7 +4350,12 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
query
.
must
(
keywordQuery
);
query
.
must
(
keywordQuery
);
// platform
// platform
BoolQueryBuilder
platformQuery
=
EsQueryTools
.
assemblePlatformQuery
(
GlobalPojo
.
PLATFORMS
);
BoolQueryBuilder
platformQuery
;
if
(
CollectionUtils
.
isEmpty
(
dto
.
getPlatforms
()))
{
platformQuery
=
EsQueryTools
.
assemblePlatformQuery
(
GlobalPojo
.
PLATFORMS
);
}
else
{
platformQuery
=
EsQueryTools
.
assemblePlatformQuery
(
Tools
.
getPlatformByIds
(
dto
.
getPlatforms
()));
}
query
.
must
(
platformQuery
);
query
.
must
(
platformQuery
);
return
query
;
return
query
;
}
}
...
...
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