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
d3b75160
Commit
d3b75160
authored
Aug 16, 2022
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022/8/16 14:06 竞品库,查热点,查危机,全网事件库-查事件
parent
790d1431
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
197 additions
and
35 deletions
+197
-35
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+14
-0
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
+59
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppCrisisController.java
+0
-12
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+4
-21
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+79
-0
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+35
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomEventServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+0
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
d3b75160
...
...
@@ -60,10 +60,24 @@ public class RedisKeyPrefix {
*/
private
static
final
String
EVENT_ANALYZE_PROGRESS
=
"BRANDKBS:EVENT:ANALYZE:PROGRESS:"
;
/**
* 竞品库-获取竞品对比舆情解读数据(PC
*/
public
static
final
String
INDEX_COMPARE_SUMMARY_PC
=
"BRANDKBS:CONTEND:COMPARESUMMARY:PC:"
;
/**
* 竞品库-获取竞品对比传播分析数据
*/
public
static
final
String
INDEX_COMPARE_ANALYZE
=
"BRANDKBS:CONTEND:COMPAREANALYZE:"
;
public
static
String
eventAnalysisProgress
(
String
eventId
,
String
projectId
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
EVENT_ANALYZE_PROGRESS
,
projectId
,
eventId
);
}
public
static
String
eventAnalysisProgress
(
String
eventId
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
EVENT_ANALYZE_PROGRESS
,
UserThreadLocal
.
getProjectId
(),
eventId
);
}
public
static
String
yuqingProgressKey
(
String
linkedGroupId
)
{
return
yuqingProgressKey
(
UserThreadLocal
.
getProjectId
(),
linkedGroupId
);
}
...
...
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
View file @
d3b75160
...
...
@@ -51,4 +51,9 @@ public class Constant {
return
-
1L
;
}
/**
* 主品牌默认竞品ID
*/
public
static
final
String
PRIMARY_CONTENDID
=
"0"
;
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
0 → 100644
View file @
d3b75160
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.util.List
;
/**
* @ClassName AppContendController
* @Description 提供前台竞品库相关信息展示
* @author cjz
* @date 2022-08-09 10:22
*/
@RestController
@RequestMapping
(
"/app/contend"
)
@Api
(
tags
=
"前台竞品库展示接口"
,
description
=
"提供前台竞品库相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppContendController
extends
BaseController
{
@Resource
(
name
=
"markDataServiceImpl"
)
MarkDataService
markDataService
;
@ApiOperation
(
"竞品库-竞品舆情-搜索条件"
)
@GetMapping
(
"/searchCriteria"
)
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
linkedGroupId
)
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
linkedGroupId
));
}
@ApiOperation
(
"竞品库-竞品舆情-搜索结果列表"
)
@GetMapping
(
"/list"
)
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchList
(
markSearchDTO
));
}
@ApiOperation
(
"竞品库-竞品分析-舆情总结页面"
)
@GetMapping
(
"/summary"
)
public
ResponseResult
getSummary
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
markSearchDTO
,
true
));
}
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@GetMapping
(
"/spread/analyze"
)
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppCrisisController.java
View file @
d3b75160
...
...
@@ -26,8 +26,6 @@ import org.springframework.web.client.RestTemplate;
@Api
(
tags
=
"前台危机展示接口"
,
description
=
"提供前台危机相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppCrisisController
extends
BaseController
{
@Value
(
"${crisis.search.url}"
)
private
String
crisisSearchUrl
;
@Value
(
"${crisis.searchTags.url}"
)
private
String
crisisTagsUrl
;
...
...
@@ -47,16 +45,6 @@ public class AppCrisisController extends BaseController {
@Autowired
private
RestTemplate
restTemplate
;
@ApiOperation
(
"危机库-查危机"
)
@GetMapping
(
"/crisisSearch"
)
public
ResponseResult
crisisSearch
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"3"
)
Integer
pageSize
,
@RequestParam
(
"keyword"
)
String
keyword
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisSearchUrl
,
String
.
class
,
page
,
pageSize
,
keyword
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"危机库-通过标签查危机"
)
@GetMapping
(
"/crisisTags"
)
public
ResponseResult
crisisTags
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
d3b75160
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
...
...
@@ -48,9 +49,6 @@ public class AppHotController extends BaseController {
@Value
(
"${trends.longTimeInListSearchByInner.url}"
)
private
String
trendsListUrl
;
@Value
(
"${trends.findHotSearchESDataInTimeByInner.url}"
)
private
String
trendsSearchUrl
;
@Value
(
"${trends.longTimeInListSearch.url}"
)
private
String
longTimeInListSearchUrl
;
...
...
@@ -74,7 +72,7 @@ public class AppHotController extends BaseController {
* douyin 抖音
* bilibili-ranking B站
*/
@ApiOperation
(
"热点库"
)
@ApiOperation
(
"热点库
-列表
"
)
@GetMapping
(
"/getHotList"
)
public
ResponseResult
getHotList
(
@RequestParam
(
value
=
"sortType"
,
defaultValue
=
"realTime"
)
String
sortType
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"weibo"
)
String
type
){
...
...
@@ -96,21 +94,6 @@ public class AppHotController extends BaseController {
}
}
@ApiOperation
(
"热点库-查热点"
)
@GetMapping
(
"/searchHotList"
)
public
ResponseResult
searchHotList
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"weibo"
)
String
type
,
@RequestParam
(
value
=
"word"
)
String
word
){
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
trendsSearchUrl
,
JSONObject
.
class
,
limit
,
page
,
type
,
word
);
JSONObject
body
=
jsonObjectResponseEntity
.
getBody
();
if
(
Objects
.
nonNull
(
body
)){
return
ResponseResult
.
success
(
body
);
}
else
{
return
ResponseResult
.
failure
(
"响应超时"
);
}
}
@ApiOperation
(
"热点库-热点榜单"
)
@GetMapping
(
"/hot"
)
public
ResponseResult
hot
(){
...
...
@@ -142,14 +125,14 @@ public class AppHotController extends BaseController {
Date
startDate
=
DateUtils
.
addHours
(
endDate
,
-
24
);
List
<
Map
.
Entry
<
String
,
Integer
>>
markTopTitleList
=
markDataService
.
getMarkTopTitle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
null
,
projectId
,
linkedGroupId
,
"0"
,
size
);
markDataService
.
getMarkTopTitle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
null
,
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTENDID
,
size
);
List
<
JSONObject
>
resultList
=
markTopTitleList
.
stream
().
map
(
map
->
{
JSONObject
resultJsonObject
=
new
JSONObject
();
resultJsonObject
.
put
(
"title"
,
map
.
getKey
());
resultJsonObject
.
put
(
"num"
,
map
.
getValue
());
try
{
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
map
.
getKey
(),
projectId
,
linkedGroupId
);
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
map
.
getKey
(),
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTENDID
);
resultJsonObject
.
put
(
"content"
,
firstArticle
.
getContent
());
resultJsonObject
.
put
(
"url"
,
firstArticle
.
getUrl
());
resultJsonObject
.
put
(
"realSource"
,
firstArticle
.
getRealSource
());
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
0 → 100644
View file @
d3b75160
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.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Objects
;
/**
* @ClassName AppSearchController
* @Description 提供前台搜索相关功能
* @author cjz
* @date 2022-08-15 16:17
*/
@RestController
@RequestMapping
(
"/app/search"
)
@Api
(
tags
=
"前台搜索相关接口"
,
description
=
"提供搜索相关功能"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppSearchController
{
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${trends.findHotSearchESDataInTimeByInner.url}"
)
private
String
trendsSearchUrl
;
@Value
(
"${crisis.search.url}"
)
private
String
crisisSearchUrl
;
@Value
(
"${ef.search.url}"
)
private
String
getEfSearchUrl
;
@ApiOperation
(
"搜索-查热点"
)
@GetMapping
(
"/hot/list"
)
public
ResponseResult
searchHotList
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"weibo"
)
String
type
,
@RequestParam
(
value
=
"word"
)
String
word
){
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
trendsSearchUrl
,
JSONObject
.
class
,
limit
,
page
,
type
,
word
);
JSONObject
body
=
jsonObjectResponseEntity
.
getBody
();
if
(
Objects
.
nonNull
(
body
)){
return
ResponseResult
.
success
(
body
);
}
else
{
return
ResponseResult
.
failure
(
"响应超时"
);
}
}
@ApiOperation
(
"搜索-查危机"
)
@GetMapping
(
"/crisisSearch"
)
public
ResponseResult
crisisSearch
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"3"
)
Integer
pageSize
,
@RequestParam
(
"keyword"
)
String
keyword
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisSearchUrl
,
String
.
class
,
page
,
pageSize
,
keyword
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"搜索-全网事件库-查事件"
)
@GetMapping
(
"/getWholeNetworkEvents"
)
public
ResponseResult
getWholeNetworkEvents
(
@RequestParam
(
"keyword"
)
String
keyword
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
){
String
name
=
keyword
.
trim
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getEfSearchUrl
,
String
.
class
,
name
,
page
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
return
ResponseResult
.
success
(
jsonObject
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
d3b75160
...
...
@@ -8,8 +8,10 @@ import com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -141,7 +143,7 @@ public interface MarkDataService {
* @param linkedGroupId 关联组id
* @return 首发稿件
*/
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
)
throws
IOException
;
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
)
throws
IOException
;
/**
* 搜索标注数据通过事件
...
...
@@ -163,4 +165,36 @@ public interface MarkDataService {
*/
List
<
JSONObject
>
searchMarkDataByTime
(
String
projectId
,
String
linkedGroupId
,
String
contendId
,
Long
startTime
,
Long
endTime
,
String
...
fetchSource
);
/**
* 竞品库-获取搜索条件
* @param linkedGroupId 关联组Id
* @return 搜索条件
*/
JSONObject
getContendSearchCriteria
(
String
linkedGroupId
);
/**
* 竞品库-获取搜索结果列表
* @param markSearchDTO 标注数据搜索传输类
* @return 搜索结果列表
*/
PageVO
<
MarkFlowEntity
>
getContendSearchList
(
MarkSearchDTO
markSearchDTO
)
throws
IOException
;
/**
* 竞品库-获取竞品对比舆情解读数据
*
* @param markSearchDTO 标注数据搜索传输类
* @param cache 是否启用缓存
* @return 竞品对比舆情解读数据
*/
JSONObject
getContendSummary
(
MarkSearchDTO
markSearchDTO
,
boolean
cache
)
throws
IOException
;
/**
* 竞品库-获取竞品对比传播分析数据
* @param markSearchDTO 标注数据搜索传输类
* @param hotArticleSize 热门稿件数量
* @param cache 是否启用缓存
* @return
*/
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
;
}
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomEventServiceImpl.java
View file @
d3b75160
...
...
@@ -99,7 +99,7 @@ public class CustomEventServiceImpl implements CustomEventService {
JSONObject
result
=
new
JSONObject
();
String
aggTitle
=
map
.
getKey
();
try
{
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startTime
,
endTime
,
aggTitle
,
projectId
,
linkedGroupId
);
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startTime
,
endTime
,
aggTitle
,
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTENDID
);
result
.
put
(
"title"
,
firstArticle
.
getTitle
());
result
.
put
(
"time"
,
firstArticle
.
getTime
());
result
.
put
(
"url"
,
firstArticle
.
getUrl
());
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
d3b75160
This diff is collapsed.
Click to expand it.
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