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
00cc4f36
Commit
00cc4f36
authored
Feb 27, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature' into feature
parents
f077b961
ba4b55cf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
11 deletions
+22
-11
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+7
-0
src/main/java/com/zhiwei/brandkbs2/model/ResponseResult.java
+5
-3
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+10
-8
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
00cc4f36
...
...
@@ -4,6 +4,7 @@ package com.zhiwei.brandkbs2.controller.app;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
...
...
@@ -71,6 +72,9 @@ public class AppSearchController extends BaseController {
@Resource
(
name
=
"commonServiceImpl"
)
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
@ApiOperation
(
"搜索-查热点"
)
@GetMapping
(
"/hot/list"
)
public
ResponseResult
searchHotList
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
limit
,
...
...
@@ -129,6 +133,8 @@ public class AppSearchController extends BaseController {
@ApiOperation
(
"搜索-全网搜"
)
@PostMapping
(
"/searchWhole"
)
public
ResponseResult
searchWholeNetwork
(
@RequestBody
SearchFilterDTO
dto
)
{
// 针对商业数据库做限制
if
(
2
==
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getWholeSearchDataSource
())
{
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
if
(
time
>
dto
.
getStartTime
())
{
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
...
...
@@ -139,6 +145,7 @@ public class AppSearchController extends BaseController {
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
return
ResponseResult
.
failure
(
"时间跨度不能超过30天"
);
}
}
return
ResponseResult
.
success
(
markDataService
.
searchWholeNetwork
(
dto
));
}
...
...
src/main/java/com/zhiwei/brandkbs2/model/ResponseResult.java
View file @
00cc4f36
...
...
@@ -85,11 +85,13 @@ public class ResponseResult {
/**
* 操作失败带返回数据
*
* @param
data 返回数据
* @param
message 失败信息
* @return 操作失败带返回数据
*/
public
static
ResponseResult
failure
(
Object
data
)
{
return
new
ResponseResult
(
CommonCodeEnum
.
FAIL
,
data
);
public
static
ResponseResult
failure
(
String
message
)
{
ResponseResult
responseResult
=
new
ResponseResult
(
CommonCodeEnum
.
FAIL
,
null
);
responseResult
.
setMessage
(
message
);
return
responseResult
;
}
/**
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
00cc4f36
...
...
@@ -1160,10 +1160,10 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"priGtAvg"
,
priGreaterThanAvg
);
// 获取主品牌传播峰值时信息
LineVO
primaryMax
=
primarySpread
.
stream
().
max
(
Comparator
.
comparing
(
LineVO:
:
getCount
)).
orElse
(
new
LineVO
());
result
.
put
(
"priMaxTime"
,
sdf
.
format
(
primaryMax
.
getDate
()
));
result
.
put
(
"priMaxTime"
,
primaryMax
.
getDate
(
));
result
.
put
(
"priMaxCount"
,
primaryMax
.
getCount
());
long
priMaxDayStartTime
=
primaryMax
.
getDate
(
);
long
priMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
pri
maryMax
.
getDate
()
),
1
).
getTime
();
long
priMaxDayStartTime
=
Tools
.
truncDate
(
primaryMax
.
getDate
(),
Constant
.
DAY_PATTERN
);
long
priMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
pri
MaxDayStartTime
),
1
).
getTime
();
// 获取时间段某情感数据最多的标题
List
<
Map
.
Entry
<
String
,
Integer
>>
priTopTitle
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
1
);
...
...
@@ -1175,7 +1175,8 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"priTopTitleUrl"
,
priFirstArticle
.
getUrl
());
}
// 获取主品牌热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
priHotTitles
))
{
List
<
JSONObject
>
priHotArticle
=
priHotTitles
.
stream
().
map
(
map
->
{
JSONObject
jsonObject
=
new
JSONObject
();
...
...
@@ -1206,10 +1207,11 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"conGtAvg"
,
conGreaterThanAvg
);
//获取竞品传播峰值信息
LineVO
contendMax
=
contendSpread
.
stream
().
max
(
Comparator
.
comparing
(
LineVO:
:
getCount
)).
orElse
(
new
LineVO
());
result
.
put
(
"conMaxTime"
,
sdf
.
format
(
contendMax
.
getDate
()
));
result
.
put
(
"conMaxTime"
,
contendMax
.
getDate
(
));
result
.
put
(
"conMaxCount"
,
contendMax
.
getCount
());
long
conMaxDayStartTime
=
contendMax
.
getDate
();
long
conMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
contendMax
.
getDate
()),
1
).
getTime
();
long
conMaxDayStartTime
=
Tools
.
truncDate
(
contendMax
.
getDate
(),
Constant
.
DAY_PATTERN
);
long
conMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
conMaxDayStartTime
),
1
).
getTime
();
List
<
Map
.
Entry
<
String
,
Integer
>>
conTopTitle
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendLinkedGroupId
,
contendId
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
conTopTitle
))
{
...
...
@@ -1220,7 +1222,7 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"conTopTitleUrl"
,
conFirstArticle
.
getUrl
());
}
// 获取竞品热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayE
ndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
startTime
,
e
ndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendLinkedGroupId
,
contendId
,
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
conHotTitles
))
{
List
<
JSONObject
>
conHotArticle
=
conHotTitles
.
stream
().
map
(
map
->
{
...
...
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