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
e4503941
Commit
e4503941
authored
Dec 18, 2024
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
趋势图修复
parent
c5ed5b2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
8 deletions
+59
-8
src/main/java/com/zhiwei/brandkbs2/service/impl/SearchWholeServiceImpl.java
+10
-8
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
+49
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/service/impl/SearchWholeServiceImpl.java
View file @
e4503941
...
...
@@ -889,16 +889,17 @@ public class SearchWholeServiceImpl implements SearchWholeService {
long
count
=
bucket
.
getDocCount
();
res
.
add
(
new
LineVO
(
count
,
time
));
});
List
<
LineVO
>
resLine
=
Tools
.
completeLine
(
res
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
// 由于结束点为开区间,将结束点数据补完
if
(
CollectionUtils
.
isNotEmpty
(
res
)){
res
.
get
(
0
).
setDate
(
dto
.
getStartTime
());
if
(
CollectionUtils
.
isNotEmpty
(
res
Line
)){
//
res.get(0).setDate(dto.getStartTime());
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
searchFilterDTO
.
setEndTime
(
dto
.
getEndTime
()
+
1
);
Long
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
res
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
res
Line
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
}
return
res
;
return
res
Line
;
}
/**
...
...
@@ -966,9 +967,10 @@ public class SearchWholeServiceImpl implements SearchWholeService {
platformLines
.
forEach
((
k1
,
v1
)
->
{
List
<
LineVO
>
line
=
new
ArrayList
<>();
v1
.
forEach
((
k2
,
v2
)
->
line
.
add
(
new
LineVO
(
v2
,
Long
.
valueOf
(
k2
))));
List
<
LineVO
>
resLine
=
Tools
.
completeLine
(
line
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
// 结束点数据补充完全
if
(
CollectionUtils
.
isNotEmpty
(
l
ine
)){
line
.
get
(
0
).
setDate
(
dto
.
getStartTime
());
if
(
CollectionUtils
.
isNotEmpty
(
resL
ine
)){
//
line.get(0).setDate(dto.getStartTime());
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
searchFilterDTO
.
setPlatforms
(
Collections
.
singletonList
(
GlobalPojo
.
getPlatformIdByName
(
k1
)));
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
...
...
@@ -978,9 +980,9 @@ public class SearchWholeServiceImpl implements SearchWholeService {
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
}
catch
(
IOException
ignore
)
{
}
l
ine
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
resL
ine
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
}
res
.
put
(
k1
,
l
ine
);
res
.
put
(
k1
,
resL
ine
);
});
return
res
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
View file @
e4503941
...
...
@@ -17,6 +17,7 @@ import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.vo.LineVO
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
...
...
@@ -1422,4 +1423,51 @@ public class Tools {
}
return
new
Long
[]{
calendar1
.
getTime
().
getTime
(),
calendar2
.
getTime
().
getTime
()};
}
/**
* 补全图谱
* @param lines
* @param startTime
* @param endTime
* @return
*/
public
static
List
<
LineVO
>
completeLine
(
List
<
LineVO
>
lines
,
Long
startTime
,
Long
endTime
){
int
size
=
endTime
-
startTime
>
7
*
Constant
.
ONE_DAY
?
30
:
(
endTime
-
startTime
<=
Constant
.
ONE_DAY
?
24
:
7
);
long
timeRange
=
7
==
size
||
30
==
size
?
Constant
.
ONE_DAY
:
Constant
.
ONE_HOUR
;
if
(
lines
.
size
()
<
size
){
// 无数据,按时间段全部补为0
if
(
CollectionUtils
.
isEmpty
(
lines
)){
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
lines
.
add
(
new
LineVO
(
0L
,
startTime
));
startTime
=
startTime
+
timeRange
;
if
(
startTime
>=
endTime
||
lines
.
size
()
>=
size
){
break
;
}
}
return
lines
;
}
else
{
// 往前补0
LineVO
startLine
=
lines
.
get
(
0
);
Long
startLineTime
=
startLine
.
getDate
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
startLineTime
=
startLineTime
-
timeRange
;
if
(
startLineTime
<=
startTime
||
lines
.
size
()
>=
size
){
break
;
}
lines
.
add
(
0
,
new
LineVO
(
0L
,
startLineTime
));
}
// 往后补0
LineVO
endLine
=
lines
.
get
(
lines
.
size
()
-
1
);
Long
endLineTime
=
endLine
.
getDate
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
endLineTime
=
endLineTime
+
timeRange
;
if
(
endLineTime
>=
endTime
||
lines
.
size
()
>=
size
){
break
;
}
lines
.
add
(
new
LineVO
(
0L
,
endLineTime
));
}
}
}
return
lines
;
}
}
\ No newline at end of file
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