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
cfdc79ca
Commit
cfdc79ca
authored
Sep 06, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022/9/6 16:33
parent
618c0907
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
31 deletions
+73
-31
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+0
-6
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+39
-6
src/main/java/com/zhiwei/brandkbs2/pojo/AggreeResult.java
+7
-6
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/pojo/CustomEvent.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ChannelVO.java
+4
-1
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
+7
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomEventServiceImpl.java
+4
-3
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
+0
-1
No files found.
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
View file @
cfdc79ca
...
...
@@ -33,7 +33,7 @@ public class GenericAttribute {
/**
* es media_type
*/
public
static
final
String
ES_MEDIA_TYPE
=
"media_type"
;
//
public static final String ES_MEDIA_TYPE = "media_type";
// es platform_id
public
static
final
String
ES_PLATFORM_ID
=
"platform_id"
;
// es channel_influence
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
cfdc79ca
...
...
@@ -140,12 +140,6 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
}
@ApiOperation
(
"最新事件"
)
@GetMapping
(
"/getLastEventTop"
)
public
ResponseResult
getLastEventTop
()
{
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
null
,
5
));
}
@ApiOperation
(
"关联事件"
)
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键词"
,
paramType
=
"query"
,
dataType
=
"String"
)
@GetMapping
(
"/getRelevanceEvent"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
cfdc79ca
...
...
@@ -7,9 +7,12 @@ import com.zhiwei.brandkbs2.auth.Auth;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.Api
;
...
...
@@ -57,6 +60,12 @@ public class AppSearchController {
@Resource
(
name
=
"channelServiceImpl"
)
ChannelService
channelService
;
@Resource
(
name
=
"eventServiceImpl"
)
EventService
eventService
;
@Resource
(
name
=
"commonServiceImpl"
)
CommonService
commonService
;
@ApiOperation
(
"搜索-查热点"
)
@GetMapping
(
"/hot/list"
)
public
ResponseResult
searchHotList
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
limit
,
...
...
@@ -106,27 +115,33 @@ public class AppSearchController {
return
ResponseResult
.
success
(
markDataService
.
searchWholeNetwork
(
dto
));
}
@ApiOperation
(
"舆情列表"
)
@ApiOperation
(
"
搜索-
舆情列表"
)
@PostMapping
(
"/mark/list"
)
public
ResponseResult
getYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
}
@ApiOperation
(
"舆情列表-搜索条件"
)
@ApiOperation
(
"
搜索-
舆情列表-搜索条件"
)
@GetMapping
(
"/mark/list/criteria"
)
public
ResponseResult
getYuqingMarkCriteria
(
@RequestParam
(
required
=
false
)
String
linkedGroupId
)
{
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkCriteria
(
linkedGroupId
));
}
@ApiOperation
(
"搜索-活跃渠道"
)
@GetMapping
(
"channel/list/active"
)
public
ResponseResult
getActiveChannelList
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"2"
)
int
size
)
{
Long
[]
timeRangeDay
=
commonService
.
getTimeRangeDay
();
return
ResponseResult
.
success
(
channelService
.
getActiveChannelList
(
"0"
,
null
,
null
,
timeRangeDay
[
0
],
timeRangeDay
[
1
],
size
));
}
@ApiOperation
(
"渠道搜索条件"
)
@ApiOperation
(
"
搜索-
渠道搜索条件"
)
@GetMapping
(
"/channel/getChannelSearchCriteria"
)
public
ResponseResult
getChannelSearchCriteria
()
{
return
ResponseResult
.
success
(
channelService
.
getChannelSearchCriteria
());
}
@ApiOperation
(
"
查渠道 渠道库
"
)
@ApiOperation
(
"
搜索-渠道列表
"
)
@PostMapping
(
value
=
"/channel/channelList"
)
public
ResponseResult
getChannelList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
int
pageSize
,
...
...
@@ -139,13 +154,31 @@ public class AppSearchController {
return
ResponseResult
.
success
(
channelService
.
getChannelList
(
page
,
pageSize
,
keyword
,
platforms
,
emotions
,
mediaTypes
,
articlesCount
,
sorter
));
}
@ApiOperation
(
"查竞品"
)
@ApiOperation
(
"搜索-热门事件"
)
@GetMapping
(
"/getLastEventTop"
)
public
ResponseResult
getLastEventTop
()
{
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
null
,
5
));
}
@ApiOperation
(
"搜索-前台事件库-搜索条件"
)
@GetMapping
(
"/event/list/criteria"
)
public
ResponseResult
getEventsSearchCriteria
()
{
return
ResponseResult
.
success
(
eventService
.
getEventsSearchCriteria
());
}
@ApiOperation
(
"搜索-前台事件库-品牌事件库"
)
@PostMapping
(
"/event/list"
)
public
ResponseResult
getEventList
(
@RequestBody
EventSearchDTO
eventSearchDTO
)
{
return
ResponseResult
.
success
(
eventService
.
getEventList
(
eventSearchDTO
));
}
@ApiOperation
(
"搜索-查竞品"
)
@PostMapping
(
"/contend/list"
)
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchList
(
markSearchDTO
));
}
@ApiOperation
(
"查竞品-搜索条件"
)
@ApiOperation
(
"
搜索-
查竞品-搜索条件"
)
@GetMapping
(
"/contend/list/criteria"
)
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
contendId
)
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
contendId
));
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/AggreeResult.java
View file @
cfdc79ca
...
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.pojo;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -82,16 +83,16 @@ public class AggreeResult extends AbstractBaseMongo {
*/
private
boolean
isFather
;
public
static
AggreeResult
createFather
(
JSONObject
json
,
String
taskId
,
Integer
aggreeSize
)
{
AggreeResult
aggreeResult
=
getInstance
(
json
,
taskId
);
public
static
AggreeResult
createFather
(
JSONObject
json
,
String
taskId
,
String
projectId
,
Integer
aggreeSize
)
{
AggreeResult
aggreeResult
=
getInstance
(
json
,
taskId
,
projectId
);
aggreeResult
.
setFather
(
true
);
aggreeResult
.
setAggreeSize
(
aggreeSize
);
aggreeResult
.
setCTime
(
System
.
currentTimeMillis
());
return
aggreeResult
;
}
public
static
AggreeResult
createSon
(
JSONObject
json
,
String
taskId
,
String
fatherId
,
String
fatherTitle
)
{
AggreeResult
aggreeResult
=
getInstance
(
json
,
taskId
);
public
static
AggreeResult
createSon
(
JSONObject
json
,
String
taskId
,
String
projectId
,
String
fatherId
,
String
fatherTitle
)
{
AggreeResult
aggreeResult
=
getInstance
(
json
,
taskId
,
projectId
);
aggreeResult
.
setFatherId
(
fatherId
);
// 使用父聚合标题
aggreeResult
.
setAggreeTitle
(
fatherTitle
);
...
...
@@ -99,13 +100,13 @@ public class AggreeResult extends AbstractBaseMongo {
return
aggreeResult
;
}
private
static
AggreeResult
getInstance
(
JSONObject
json
,
String
taskId
)
{
private
static
AggreeResult
getInstance
(
JSONObject
json
,
String
taskId
,
String
projectId
)
{
AggreeResult
aggreeResult
=
new
AggreeResult
();
aggreeResult
.
setTaskId
(
taskId
);
BaseMap
baseMap
=
Tools
.
getBaseFromEsMap
(
json
);
aggreeResult
.
setTime
(
baseMap
.
getTime
());
aggreeResult
.
setPlatformId
(
json
.
getString
(
GenericAttribute
.
ES_PLATFORM_ID
));
String
mediaType
=
json
.
getString
(
GenericAttribute
.
ES_MEDIA_TYPE
);
String
mediaType
=
GlobalPojo
.
getMediaType
(
projectId
,
baseMap
.
getPlatform
(),
baseMap
.
getSource
()
);
if
(
StringUtils
.
isNotEmpty
(
mediaType
))
{
aggreeResult
.
setMediaTypes
(
Arrays
.
asList
(
mediaType
.
split
(
","
)));
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
View file @
cfdc79ca
...
...
@@ -62,6 +62,8 @@ public class Channel extends ChannelIndex {
*/
private
Long
collectTime
;
private
Double
influence
;
public
void
setLastTime
(
Long
lastTime
)
{
if
(
null
==
this
.
lastTime
||
this
.
lastTime
<
lastTime
)
{
this
.
lastTime
=
lastTime
;
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/CustomEvent.java
View file @
cfdc79ca
...
...
@@ -48,7 +48,7 @@ public class CustomEvent extends AbstractBaseMongo {
/**
* 关联项目组ID
*/
private
String
linkedGroup
Id
;
private
String
contend
Id
;
/**
* 将自定义事件传输对象转换为自定义事件对象
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ChannelVO.java
View file @
cfdc79ca
...
...
@@ -63,7 +63,10 @@ public class ChannelVO {
channelVO
.
setArticleCount
(
channel
.
getArticleCount
());
// TODO influence实现
channelVO
.
setInfluence
(
null
);
channelVO
.
setMediaType
(
GlobalPojo
.
getMediaType
(
projectId
,
channel
.
getPlatform
(),
channel
.
getSource
()));
String
mediaType
=
GlobalPojo
.
getMediaType
(
projectId
,
channel
.
getPlatform
(),
channel
.
getSource
());
if
(
null
!=
mediaType
)
{
channelVO
.
setMediaType
(
mediaType
.
replaceAll
(
","
,
" "
));
}
channelVO
.
setLastArticle
(
lastArticle
);
return
channelVO
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
View file @
cfdc79ca
...
...
@@ -52,4 +52,6 @@ public interface CommonService {
Long
[]
getTimeRangeWeek
();
Long
[]
getTimeRangeDay
();
}
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
View file @
cfdc79ca
...
...
@@ -110,4 +110,11 @@ public class CommonServiceImpl implements CommonService {
return
new
Long
[]{
startTime
,
endTime
};
}
@Override
public
Long
[]
getTimeRangeDay
()
{
long
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
long
startTime
=
DateUtils
.
addDays
(
new
Date
(
endTime
),
-
1
).
getTime
();
return
new
Long
[]{
startTime
,
endTime
};
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomEventServiceImpl.java
View file @
cfdc79ca
...
...
@@ -118,11 +118,11 @@ public class CustomEventServiceImpl implements CustomEventService {
@Override
public
void
saveCustomEvent
(
CustomEventDTO
customEventDTO
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
()
;
String
contendId
=
"0"
;
CustomEvent
customEvent
=
CustomEvent
.
creatFromCustomEventDTO
(
customEventDTO
);
customEvent
.
setUpdateTime
(
System
.
currentTimeMillis
());
customEvent
.
setProjectId
(
projectId
);
customEvent
.
set
LinkedGroupId
(
linkedGroup
Id
);
customEvent
.
set
ContendId
(
contend
Id
);
customEventDao
.
insertOneWithoutId
(
customEvent
);
this
.
analyzeCustomEventData
(
customEvent
);
}
...
...
@@ -293,8 +293,9 @@ public class CustomEventServiceImpl implements CustomEventService {
customEventDao
.
updateOneByIdWithField
(
eventId
,
Update
.
update
(
"status"
,
false
));
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
{
try
{
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
customEvent
.
getProjectId
(),
customEvent
.
getContendId
()).
getBrandLinkedGroupId
();
//查询符合该事件时间段的所有稿件信息
List
<
JSONObject
>
articles
=
markDataService
.
searchMarkDataByTime
(
customEvent
.
getProjectId
(),
customEvent
.
getLinkedGroupId
(),
"0"
,
List
<
JSONObject
>
articles
=
markDataService
.
searchMarkDataByTime
(
customEvent
.
getProjectId
(),
linkedGroupId
,
customEvent
.
getContendId
()
,
customEvent
.
getStartTime
(),
customEvent
.
getEndTime
());
log
.
info
(
"自定义事件:{} 查询到符合该事件时间段的所有稿件数{}个"
,
eventId
,
articles
.
size
());
List
<
String
>
keywords
=
customEvent
.
getKeywords
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
cfdc79ca
...
...
@@ -546,11 +546,11 @@ public class EventServiceImpl implements EventService {
}
query
.
addCriteria
(
volumeCriteria
);
}
mongoUtil
.
start
(
eventSearchDTO
.
getPage
(),
eventSearchDTO
.
getPageSize
(),
query
);
// 总数
long
total
=
eventDao
.
count
(
query
);
// 排序
eventDao
.
addSort
(
query
,
eventSearchDTO
.
getSorter
().
toJSONString
());
mongoUtil
.
start
(
eventSearchDTO
.
getPage
(),
eventSearchDTO
.
getPageSize
(),
query
);
// 数据
List
<
Event
>
eventList
=
eventDao
.
findList
(
query
);
// vo封装
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
cfdc79ca
...
...
@@ -190,7 +190,7 @@ public class MarkDataServiceImpl implements MarkDataService {
List
<
List
<
JSONObject
>>
groupList
=
aggregation
(
hitsAndCounts
.
getLeft
(),
"id"
);
log
.
info
(
"taskId:{},聚合完成,聚合组:{}个"
,
uuid
,
groupList
.
size
());
// 入mongo缓存
cacheAggreeResult
(
groupList
,
uuid
);
cacheAggreeResult
(
groupList
,
uuid
,
projectId
);
redisUtil
.
setExpire
(
redisKey
,
"100"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"generateYuqingMarkAggreeList-"
,
e
);
...
...
@@ -279,11 +279,11 @@ public class MarkDataServiceImpl implements MarkDataService {
query
.
addCriteria
((
orCriteria
.
orOperator
(
tagCriteria
.
toArray
(
new
Criteria
[
0
]))));
}
// 关键词模糊查询
aggreeResultDao
.
addKeywordFuzz
(
query
,
dto
.
getKeyword
(),
"
aggreeTitl
e"
);
aggreeResultDao
.
addKeywordFuzz
(
query
,
dto
.
getKeyword
(),
"
data.sourc
e"
);
return
query
;
}
private
void
cacheAggreeResult
(
List
<
List
<
JSONObject
>>
groupList
,
String
taskId
)
{
private
void
cacheAggreeResult
(
List
<
List
<
JSONObject
>>
groupList
,
String
taskId
,
String
projectId
)
{
int
count
=
0
;
int
percent
;
for
(
List
<
JSONObject
>
list
:
groupList
)
{
...
...
@@ -294,12 +294,12 @@ public class MarkDataServiceImpl implements MarkDataService {
AggreeResult
aggreeResult
;
// 父聚合处理
if
(
i
==
0
)
{
aggreeResult
=
AggreeResult
.
createFather
(
json
,
taskId
,
list
.
size
());
aggreeResult
=
AggreeResult
.
createFather
(
json
,
taskId
,
projectId
,
list
.
size
());
aggreeResultDao
.
insertOneWithoutId
(
aggreeResult
);
fatherId
=
aggreeResult
.
getId
();
fatherTitle
=
aggreeResult
.
getAggreeTitle
();
}
else
{
aggreeResult
=
AggreeResult
.
createSon
(
json
,
taskId
,
fatherId
,
fatherTitle
);
aggreeResult
=
AggreeResult
.
createSon
(
json
,
taskId
,
projectId
,
fatherId
,
fatherTitle
);
aggreeResultDao
.
insertOneWithoutId
(
aggreeResult
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
View file @
cfdc79ca
...
...
@@ -118,7 +118,6 @@ public class MarkFlowServiceImpl implements MarkFlowService {
sourceDetails
.
put
(
"followersNum"
,
followersNum
);
}
// 渠道标签
String
channelTag
=
tJson
.
getString
(
"channel_tag"
);
if
(
null
!=
channelTag
)
{
sourceDetails
.
put
(
"channelTag"
,
channelTag
.
replaceAll
(
","
,
"|"
));
...
...
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