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
52c9e84f
Commit
52c9e84f
authored
May 11, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!320
parents
262344b2
257811d9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
87 deletions
+113
-87
pom.xml
+1
-1
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
+52
-16
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileSearchController.java
+8
-32
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
+11
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+35
-37
No files found.
pom.xml
View file @
52c9e84f
...
...
@@ -35,7 +35,7 @@
<dubbo.version>
2.7.4.1
</dubbo.version>
<curator.version>
2.12.0
</curator.version>
<push.log.version>
2.17.0-SNAPSHOT
</push.log.version>
<event-client.version>
1.0.9.
3
-SNAPSHOT
</event-client.version>
<event-client.version>
1.0.9.
4
-SNAPSHOT
</event-client.version>
<cleaner-unified-filter.version>
1.1.5-SNAPSHOT
</cleaner-unified-filter.version>
</properties>
...
...
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
View file @
52c9e84f
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
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.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EventTagEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.
mark.vo.MarkerTag
;
import
com.zhiwei.middleware.
event.pojo.vo.EventTagBrandkbsVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -24,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -41,12 +41,6 @@ public class MobileEventController extends BaseController {
@Resource
(
name
=
"eventServiceImpl"
)
private
EventService
eventService
;
@Resource
(
name
=
"commonServiceImpl"
)
private
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@ApiOperation
(
"移动端事件榜单"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
...
...
@@ -63,17 +57,59 @@ public class MobileEventController extends BaseController {
dto
.
setStartTime
(
startTime
);
dto
.
setEndTime
(
endTime
);
dto
.
setBrandId
(
brandId
);
// 按影响力降序
dto
.
setSorter
(
JSONObject
.
parseObject
(
"{\"influence\":\"descend\"}"
));
if
(
0
!=
emotion
)
{
List
<
EventTagBrandkbsVO
>
eventTags
=
eventService
.
getEventTagsCriteria
().
stream
()
.
filter
(
eventTag
->
Objects
.
equals
(
EventTagEnum
.
EVENT_ATTRIBUTE
.
getName
(),
eventTag
.
getGroupName
())).
collect
(
Collectors
.
toList
());
String
emotionName
=
EmotionEnum
.
state2Name
(
emotion
);
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
Constant
.
PRIMARY_CONTEND_ID
).
getBrandLinkedGroupId
();
List
<
MarkerTag
>
tags
=
commonService
.
getEmotionTagsWithSort
(
UserThreadLocal
.
getProjectId
(),
linkedGroupId
);
tags
.
forEach
(
tag
->
{
if
(
tag
.
getName
().
equals
(
emotionName
))
{
dto
.
setEmotions
(
Collections
.
singletonList
(
tag
.
getUniqueId
()));
if
(
1
==
eventTags
.
size
())
{
eventTags
.
get
(
0
).
getTagMapList
().
forEach
(
tag
->
{
if
(
tag
.
get
(
"name"
).
equals
(
emotionName
))
{
dto
.
setEmotions
(
Collections
.
singletonList
(
String
.
valueOf
(
tag
.
get
(
"uniqueId"
))));
}
});
}
}
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
@ApiOperation
(
"移动端事件详情-事件基础信息"
)
@GetMapping
(
"/detail/baseInfo"
)
public
ResponseResult
eventBaseInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventBaseInfo
(
eventId
));
}
@ApiOperation
(
"移动端事件详情-传播趋势图"
)
@GetMapping
(
"/detail/dissemination-trends"
)
public
ResponseResult
eventDisseminationTrends
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"小时"
)
String
type
){
return
ResponseResult
.
success
(
eventService
.
eventDisseminationTrends
(
eventId
,
type
));
}
@ApiOperation
(
"移动端事件详情-渠道发声"
)
@GetMapping
(
"/detail/channel-voices"
)
public
ResponseResult
eventChannelVoices
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"重要渠道"
)
String
type
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
value
=
"sorter"
,
required
=
false
)
String
sorter
,
@RequestParam
(
value
=
"aggregation"
,
required
=
false
)
Boolean
aggregation
){
return
ResponseResult
.
success
(
eventService
.
eventChannelVoices
(
eventId
,
type
,
page
,
pageSize
,
sorter
,
aggregation
));
}
@ApiOperation
(
"移动端事件详情-热门文章分析"
)
@GetMapping
(
"/detail/top-articles-analysis"
)
public
ResponseResult
eventTopArticlesAnalysis
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"按时间"
)
String
type
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"全部"
)
String
emotion
,
@RequestParam
(
value
=
"aggTitle"
,
required
=
false
)
String
aggTitle
){
return
ResponseResult
.
success
(
eventService
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
));
}
@ApiOperation
(
"移动端事件详情-热门渠道发声、上榜热搜、词云"
)
@GetMapping
(
"/detail/additional-info"
)
public
ResponseResult
eventDetailAdditionalInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventDetailAdditionalInfo
(
eventId
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileSearchController.java
View file @
52c9e84f
...
...
@@ -2,15 +2,11 @@ package com.zhiwei.brandkbs2.controller.mobile;
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.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -19,7 +15,6 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.List
;
/**
* @author sjj
...
...
@@ -74,33 +69,15 @@ public class MobileSearchController {
return
ResponseResult
.
success
(
channelService
.
getChannelSearchCriteria
());
}
@ApiOperation
(
"移动端关键字搜索事件列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"emotion"
,
value
=
"情感倾向"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@GetMapping
(
"/event"
)
public
ResponseResult
searchEventList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"0"
)
int
emotion
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
BrandkbsEventSearchDTO
dto
=
new
BrandkbsEventSearchDTO
();
dto
.
setPage
(
page
);
dto
.
setPageSize
(
size
);
if
(
0
!=
emotion
)
{
String
emotionName
=
EmotionEnum
.
state2Name
(
emotion
);
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
Constant
.
PRIMARY_CONTEND_ID
).
getBrandLinkedGroupId
();
List
<
MarkerTag
>
tags
=
commonService
.
getEmotionTagsWithSort
(
UserThreadLocal
.
getProjectId
(),
linkedGroupId
);
tags
.
forEach
(
tag
->
{
if
(
tag
.
getName
().
equals
(
emotionName
))
{
dto
.
setEmotions
(
Collections
.
singletonList
(
tag
.
getUniqueId
()));
}
});
@ApiOperation
(
"搜索-前台事件库-搜索条件-新"
)
@GetMapping
(
"/event/criteria/{brandId}"
)
public
ResponseResult
getEventSearchCriteriaMiddleware
(
@PathVariable
String
brandId
){
return
ResponseResult
.
success
(
eventService
.
getEventListCriteria
(
brandId
));
}
dto
.
setKeyword
(
keyword
);
@ApiOperation
(
"移动端关键字搜索事件列表"
)
@PostMapping
(
"/event"
)
public
ResponseResult
searchEventList
(
@RequestBody
BrandkbsEventSearchDTO
dto
)
{
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
...
...
@@ -115,5 +92,4 @@ public class MobileSearchController {
public
ResponseResult
getArticleCriteria
()
{
return
ResponseResult
.
success
(
markDataService
.
getMobileYuqingMarkCriteria
());
}
}
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
View file @
52c9e84f
...
...
@@ -313,4 +313,15 @@ public interface EventMiddlewareDao {
* @return EventDetailAdditionalInfo
*/
EventDetailAdditionalInfo
eventDetailAdditionalInfo
(
String
eventId
);
/**
* 获取参与某情感事件最多的平台
* @param startTime 开始时间
* @param endTime 结束时间
* @param emotion 情感倾向
* @param projectId 品见项目id
* @param contendId 品见品牌id
* @return
*/
Map
<
String
,
Integer
>
getTopPlatformAnyEmotion
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
);
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
View file @
52c9e84f
...
...
@@ -216,4 +216,9 @@ public class EventMiddlewareDaoImpl implements EventMiddlewareDao {
public
EventDetailAdditionalInfo
eventDetailAdditionalInfo
(
String
eventId
)
{
return
eventClient
.
eventDetailAdditionalInfo
(
eventId
);
}
@Override
public
Map
<
String
,
Integer
>
getTopPlatformAnyEmotion
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
return
eventClient
.
getTopPlatformAnyEmotion
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
52c9e84f
...
...
@@ -945,7 +945,7 @@ public class EventServiceImpl implements EventService {
json
.
put
(
"name"
,
name
);
switch
(
name
)
{
case
"全部"
:
json
.
put
(
"totalDisseminationVolumes"
,
n
ull
);
json
.
put
(
"totalDisseminationVolumes"
,
n
ew
long
[]{}
);
break
;
case
"≥5000"
:
json
.
put
(
"totalDisseminationVolumes"
,
new
Long
[]{
5000L
,
-
1L
});
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
52c9e84f
...
...
@@ -31,6 +31,7 @@ import com.zhiwei.brandkbs2.util.RedisUtil;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventData
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
...
@@ -549,8 +550,7 @@ public class ReportServiceImpl implements ReportService {
//统计时间段负面稿件个数
long
negNormalCount
=
markDataService
.
getYuqingMarkCount
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
);
//统计时间段总事件数
long
eventCount
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
);
long
eventCount
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
JSONObject
line
=
new
JSONObject
();
line
.
put
(
"normalCount"
,
normalCount
);
line
.
put
(
"posNormalCount"
,
posNormalCount
);
...
...
@@ -567,8 +567,8 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"posNormalMaxTime"
,
lineList
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
"posNormalCount"
))).
get
().
getDate
(
"time"
));
result
.
put
(
"neuNormalMaxTime"
,
lineList
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
"neuNormalCount"
))).
get
().
getDate
(
"time"
));
result
.
put
(
"negNormalMaxTime"
,
lineList
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
"negNormalCount"
))).
get
().
getDate
(
"time"
));
long
eventTotal
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
);
long
posEventTotal
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
);
long
eventTotal
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
posEventTotal
=
eventMiddlewareDao
.
getEventCountByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
);
result
.
put
(
"eventTotal"
,
eventTotal
);
result
.
put
(
"posEventPro"
,
eventTotal
==
0
?
0
:
posEventTotal
*
1.0
/
eventTotal
);
//获取最热稿件相关信息
...
...
@@ -580,30 +580,37 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"similarArticleCount"
,
resMap
.
getValue
());
}
//获取最热事件相关信息
List
<
Event
>
eventList
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
,
1
);
List
<
Event
>
eventList
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
eventList
))
{
Event
event
=
eventList
.
get
(
0
);
result
.
put
(
"title"
,
event
.
getName
());
result
.
put
(
"influence"
,
event
.
getInfluence
());
}
// TODO eventMiddlewareDao 需要添加获取首发稿件接口
// List<Event> posTopArticleList = eventMiddlewareDao.getEventsByProjectIdAndContendId(start, end, EmotionEnum.POSITIVE.getName(), projectId,
// Constant.PRIMARY_CONTEND_ID, 1);
// if (!Tools.isEmpty(posTopArticleList)) {
// result.put("posTopArtTitle", null);
// }
// List<Event> neuTopArticleTitleList = eventMiddlewareDao.getEventsByProjectIdAndContendId(start, end, EmotionEnum.NEUTRAL.getName(), projectId,
// Constant.PRIMARY_CONTEND_ID, 1);
// if (!Tools.isEmpty(neuTopArticleTitleList)) {
// result.put("neuTopArtTitle", neuTopArtTitle.length() <= 30 ? neuTopArtTitle : neuTopArtTitle.substring(0, 30) + "...");
// }
// List<Event> negTopArticleTitleList = eventMiddlewareDao.getEventsByProjectIdAndContendId(start, end, EmotionEnum.NEUTRAL.getName(), projectId,
// Constant.PRIMARY_CONTEND_ID, 1);
// if (!Tools.isEmpty(negTopArticleTitleList)) {
// result.put("negTopArtTitle", neuTopArtTitle.length() <= 30 ? neuTopArtTitle : neuTopArtTitle.substring(0, 30) + "...");
// }
// 三种情感倾向事件首发信息
List
<
Event
>
posTopArticleList
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
,
1
);
if
(!
Tools
.
isEmpty
(
posTopArticleList
))
{
EventData
eventData
=
posTopArticleList
.
get
(
0
).
getOriginArticle
();
if
(
Objects
.
nonNull
(
eventData
))
{
String
posTopArtTitle
=
eventData
.
getTitle
();
result
.
put
(
"posTopArtTitle"
,
posTopArtTitle
.
length
()
<=
30
?
posTopArtTitle
:
posTopArtTitle
.
substring
(
0
,
30
)
+
"..."
);
}
}
List
<
Event
>
neuTopArticleTitleList
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
,
1
);
if
(!
Tools
.
isEmpty
(
neuTopArticleTitleList
))
{
EventData
eventData
=
neuTopArticleTitleList
.
get
(
0
).
getOriginArticle
();
if
(
Objects
.
nonNull
(
eventData
))
{
String
neuTopArtTitle
=
eventData
.
getTitle
();
result
.
put
(
"neuTopArtTitle"
,
neuTopArtTitle
.
length
()
<=
30
?
neuTopArtTitle
:
neuTopArtTitle
.
substring
(
0
,
30
)
+
"..."
);
}
}
List
<
Event
>
negTopArticleTitleList
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
,
1
);
if
(!
Tools
.
isEmpty
(
negTopArticleTitleList
))
{
EventData
eventData
=
negTopArticleTitleList
.
get
(
0
).
getOriginArticle
();
if
(
Objects
.
nonNull
(
eventData
))
{
String
negTopArtTitle
=
eventData
.
getTitle
();
result
.
put
(
"negTopArtTitle"
,
negTopArtTitle
.
length
()
<=
30
?
negTopArtTitle
:
negTopArtTitle
.
substring
(
0
,
30
)
+
"..."
);
}
}
return
result
;
}
...
...
@@ -617,19 +624,11 @@ public class ReportServiceImpl implements ReportService {
*/
private
JSONObject
getMobileBrandEvent
(
Long
startTime
,
Long
endTime
,
String
projectId
)
{
JSONObject
result
=
new
JSONObject
();
// TODO eventMiddlewareDao需要提供 获取参与某情感事件最多的平台列表
// List<Map<String, Object>> topPlatforms = iEventService.selectTopPlatformByTimeAndEmotionAndProjectIdAndContendId
// (startTimeStr, endTimeStr, EmotionEnum.NEGATIVE.getState(), pid, Constant.PRIMARY_CONTENDID);
// //负面事件舆情平台top
// result.put("topPlatforms", topPlatforms.stream()
// .sorted((o1, o2) -> Integer.valueOf(o2.get("num").toString()).compareTo(Integer.valueOf(o1.get("num").toString())))
// .limit(3)
// .map(map -> map.get("platform"))
// .collect(Collectors.toList()));
// 获取参与某情感事件最多的平台列表
Map
<
String
,
Integer
>
topPlatformAnyEmotion
=
eventMiddlewareDao
.
getTopPlatformAnyEmotion
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
);
result
.
put
(
"topPlatforms"
,
topPlatformAnyEmotion
.
keySet
().
stream
().
limit
(
3
).
collect
(
Collectors
.
toList
()));
//负面事件传播周期
List
<
Event
>
negEvents
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
,
50
);
List
<
Event
>
negEvents
=
eventMiddlewareDao
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
,
50
);
List
<
Integer
>
spreadDayList
=
negEvents
.
stream
().
map
(
event
->
{
Long
start
=
event
.
getStartTime
();
Long
end
=
Boolean
.
TRUE
.
equals
(
event
.
getEndStatus
())
&&
event
.
getEndTime
()
<
endTime
?
event
.
getEndTime
()
:
endTime
;
...
...
@@ -657,8 +656,7 @@ public class ReportServiceImpl implements ReportService {
return
jsonObject
;
}).
collect
(
Collectors
.
toList
()));
//正面事件传播量top
List
<
Event
>
topPosEvents
=
eventMiddlewareDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
Constant
.
PRIMARY_CONTEND_ID
,
5
);
List
<
Event
>
topPosEvents
=
eventMiddlewareDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
,
5
);
result
.
put
(
"topPosEvents"
,
topPosEvents
.
stream
()
.
map
(
event
->
{
JSONObject
jsonObject
=
new
JSONObject
();
...
...
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