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
28ae2919
Commit
28ae2919
authored
Feb 06, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!188
parents
50cfa6ce
9ac58d98
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
216 additions
and
106 deletions
+216
-106
pom.xml
+1
-1
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+4
-2
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+19
-1
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDaoImpl.java
+10
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDataDaoImpl.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/enmus/RoleEnum.java
+6
-1
src/main/java/com/zhiwei/brandkbs2/interceptor/MainAuthInterceptor.java
+2
-1
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ExportAppChannelEventDTO.java
+10
-4
src/main/java/com/zhiwei/brandkbs2/pojo/external/BrandkbsHotEventWarn.java
+8
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+61
-49
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
+22
-14
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
+32
-16
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+35
-11
No files found.
pom.xml
View file @
28ae2919
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<dubbo.version>
2.7.4.1
</dubbo.version>
<dubbo.version>
2.7.4.1
</dubbo.version>
<curator.version>
2.12.0
</curator.version>
<curator.version>
2.12.0
</curator.version>
<push.log.version>
2.17.0-SNAPSHOT
</push.log.version>
<push.log.version>
2.17.0-SNAPSHOT
</push.log.version>
<event-client.version>
1.0.
2
-SNAPSHOT
</event-client.version>
<event-client.version>
1.0.
4
-SNAPSHOT
</event-client.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
28ae2919
...
@@ -21,8 +21,6 @@ import org.springframework.http.ResponseEntity;
...
@@ -21,8 +21,6 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.List
;
/**
/**
* @Description: 前台事件库
* @Description: 前台事件库
* @Author: shentao
* @Author: shentao
...
@@ -74,18 +72,21 @@ public class AppEventController extends BaseController {
...
@@ -74,18 +72,21 @@ public class AppEventController extends BaseController {
@ApiOperation
(
"前台事件库-事件详情-基础信息"
)
@ApiOperation
(
"前台事件库-事件详情-基础信息"
)
@GetMapping
(
"/info/base/{id}"
)
@GetMapping
(
"/info/base/{id}"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
getEventBaseInfo
(
@PathVariable
String
id
)
{
public
ResponseResult
getEventBaseInfo
(
@PathVariable
String
id
)
{
return
ResponseResult
.
success
(
eventService
.
getEventBaseInfo
(
id
));
return
ResponseResult
.
success
(
eventService
.
getEventBaseInfo
(
id
));
}
}
@ApiOperation
(
"前台事件库-事件详情-传播趋势图"
)
@ApiOperation
(
"前台事件库-事件详情-传播趋势图"
)
@GetMapping
(
"/info/dissemination-trends/{id}"
)
@GetMapping
(
"/info/dissemination-trends/{id}"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
getEventDisseminationTrends
(
@PathVariable
String
id
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"小时"
)
String
type
)
{
public
ResponseResult
getEventDisseminationTrends
(
@PathVariable
String
id
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"小时"
)
String
type
)
{
return
ResponseResult
.
success
(
eventService
.
getEventDisseminationTrends
(
id
,
type
));
return
ResponseResult
.
success
(
eventService
.
getEventDisseminationTrends
(
id
,
type
));
}
}
@ApiOperation
(
"前台事件库-事件详情-渠道发声"
)
@ApiOperation
(
"前台事件库-事件详情-渠道发声"
)
@GetMapping
(
"/info/channel-voices/{id}"
)
@GetMapping
(
"/info/channel-voices/{id}"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
getEventChannelVoices
(
@PathVariable
String
id
,
public
ResponseResult
getEventChannelVoices
(
@PathVariable
String
id
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"重要渠道"
)
String
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"重要渠道"
)
String
type
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
...
@@ -96,6 +97,7 @@ public class AppEventController extends BaseController {
...
@@ -96,6 +97,7 @@ public class AppEventController extends BaseController {
@ApiOperation
(
"前台事件库-事件详情-热门文章分析"
)
@ApiOperation
(
"前台事件库-事件详情-热门文章分析"
)
@GetMapping
(
"/info/top-articles-analysis/{id}"
)
@GetMapping
(
"/info/top-articles-analysis/{id}"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
getEventTopArticlesAnalysis
(
@PathVariable
String
id
,
public
ResponseResult
getEventTopArticlesAnalysis
(
@PathVariable
String
id
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"按时间"
)
String
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"按时间"
)
String
type
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"全部"
)
String
emotion
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"全部"
)
String
emotion
,
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
28ae2919
...
@@ -10,8 +10,10 @@ import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
...
@@ -10,8 +10,10 @@ import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.*
;
import
com.zhiwei.brandkbs2.pojo.dto.*
;
import
com.zhiwei.brandkbs2.pojo.vo.ChannelListVO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
@@ -168,7 +170,11 @@ public class AppSearchController extends BaseController {
...
@@ -168,7 +170,11 @@ public class AppSearchController extends BaseController {
@GetMapping
(
"channel/list/active"
)
@GetMapping
(
"channel/list/active"
)
public
ResponseResult
getActiveChannelList
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"2"
)
int
size
)
{
public
ResponseResult
getActiveChannelList
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"2"
)
int
size
)
{
Long
[]
timeRangeDay
=
commonService
.
getTimeRangeDay
();
Long
[]
timeRangeDay
=
commonService
.
getTimeRangeDay
();
return
ResponseResult
.
success
(
channelService
.
getActiveChannelList
(
"0"
,
null
,
null
,
timeRangeDay
[
0
],
timeRangeDay
[
1
],
size
,
true
));
List
<
ChannelListVO
>
activeChannelList
=
channelService
.
getActiveChannelList
(
"0"
,
null
,
null
,
timeRangeDay
[
0
],
timeRangeDay
[
1
],
size
,
true
);
if
(
activeChannelList
.
size
()
>
2
)
{
activeChannelList
=
activeChannelList
.
subList
(
0
,
2
);
}
return
ResponseResult
.
success
(
activeChannelList
);
}
}
@ApiOperation
(
"搜索-渠道搜索条件"
)
@ApiOperation
(
"搜索-渠道搜索条件"
)
...
@@ -203,6 +209,18 @@ public class AppSearchController extends BaseController {
...
@@ -203,6 +209,18 @@ public class AppSearchController extends BaseController {
return
ResponseResult
.
success
(
eventService
.
getEventList
(
eventSearchDTO
));
return
ResponseResult
.
success
(
eventService
.
getEventList
(
eventSearchDTO
));
}
}
@ApiOperation
(
"搜索-前台事件库-搜索条件-新"
)
@GetMapping
(
"/event/criteria/{brandId}"
)
public
ResponseResult
getEventSearchCriteriaMiddleware
(
@PathVariable
String
brandId
){
return
ResponseResult
.
success
(
eventService
.
getEventListCriteria
(
brandId
));
}
@ApiOperation
(
"搜索-前台事件库-品牌事件库-新"
)
@PostMapping
(
"/event/newList"
)
public
ResponseResult
getEventListMiddleware
(
@RequestBody
BrandkbsEventSearchDTO
dto
){
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
@ApiOperation
(
"搜索-查竞品"
)
@ApiOperation
(
"搜索-查竞品"
)
@PostMapping
(
"/contend/list"
)
@PostMapping
(
"/contend/list"
)
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDaoImpl.java
View file @
28ae2919
...
@@ -54,6 +54,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -54,6 +54,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
}
}
@Override
@Override
@Deprecated
public
List
<
String
>
getEvents
(
ChannelIndex
channelIndex
)
{
public
List
<
String
>
getEvents
(
ChannelIndex
channelIndex
)
{
// 添加渠道唯一标识
// 添加渠道唯一标识
Criteria
criteria
=
addChannelIndex
(
channelIndex
);
Criteria
criteria
=
addChannelIndex
(
channelIndex
);
...
@@ -68,18 +69,21 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -68,18 +69,21 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
}
}
@Override
@Override
@Deprecated
public
Map
<
Long
,
List
<
Event
>>
getEventDay
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
)
{
public
Map
<
Long
,
List
<
Event
>>
getEventDay
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
)
{
// return getEventTimePattern(channelIndex, startTime, endTime, 8 + 2);
// return getEventTimePattern(channelIndex, startTime, endTime, 8 + 2);
return
getEventTimePatternNew
(
channelIndex
,
startTime
,
endTime
,
false
);
return
getEventTimePatternNew
(
channelIndex
,
startTime
,
endTime
,
false
);
}
}
@Override
@Override
@Deprecated
public
Map
<
Long
,
List
<
Event
>>
getEventMonth
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
)
{
public
Map
<
Long
,
List
<
Event
>>
getEventMonth
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
)
{
// return getEventTimePattern(channelIndex, startTime, endTime, 6 + 1);
// return getEventTimePattern(channelIndex, startTime, endTime, 6 + 1);
return
getEventTimePatternNew
(
channelIndex
,
startTime
,
endTime
,
true
);
return
getEventTimePatternNew
(
channelIndex
,
startTime
,
endTime
,
true
);
}
}
@Override
@Override
@Deprecated
public
long
getEventCount
(
ChannelIndex
channelIndex
,
List
<
String
>
eventEmotions
,
String
emotion
)
{
public
long
getEventCount
(
ChannelIndex
channelIndex
,
List
<
String
>
eventEmotions
,
String
emotion
)
{
long
res
=
0
;
long
res
=
0
;
Criteria
criteria
=
Criteria
.
where
(
"channelFid"
).
is
(
channelIndex
.
getFid
());
Criteria
criteria
=
Criteria
.
where
(
"channelFid"
).
is
(
channelIndex
.
getFid
());
...
@@ -98,11 +102,13 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -98,11 +102,13 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
}
}
@Override
@Override
@Deprecated
public
long
getEventCountByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
public
long
getEventCountByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
return
mongoTemplate
.
count
(
Query
.
query
(
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
)),
COLLECTION_NAME
);
return
mongoTemplate
.
count
(
Query
.
query
(
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
)),
COLLECTION_NAME
);
}
}
@Override
@Override
@Deprecated
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
Query
query
=
new
Query
();
Query
query
=
new
Query
();
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
...
@@ -114,6 +120,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -114,6 +120,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
}
}
@Override
@Override
@Deprecated
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
List
<
String
>
emotions
,
String
projectId
,
String
contendId
,
int
limit
)
{
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
List
<
String
>
emotions
,
String
projectId
,
String
contendId
,
int
limit
)
{
Query
query
=
new
Query
();
Query
query
=
new
Query
();
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotions
,
projectId
,
contendId
);
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotions
,
projectId
,
contendId
);
...
@@ -125,6 +132,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -125,6 +132,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
}
}
@Override
@Override
@Deprecated
public
List
<
Event
>
getEventsByTotalChannelVolumeTop
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
public
List
<
Event
>
getEventsByTotalChannelVolumeTop
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
Query
query
=
new
Query
();
Query
query
=
new
Query
();
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
Criteria
criteria
=
eventCountCriteria
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
...
@@ -135,6 +143,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -135,6 +143,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
return
mongoTemplate
.
find
(
query
,
clazz
,
COLLECTION_NAME
);
return
mongoTemplate
.
find
(
query
,
clazz
,
COLLECTION_NAME
);
}
}
@Deprecated
private
Criteria
eventCountCriteria
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
private
Criteria
eventCountCriteria
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
);
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
);
criteria
.
and
(
"contendId"
).
is
(
contendId
);
criteria
.
and
(
"contendId"
).
is
(
contendId
);
...
@@ -257,6 +266,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
...
@@ -257,6 +266,7 @@ public class EventDaoImpl extends BaseMongoDaoImpl<Event> implements EventDao {
return
res
;
return
res
;
}
}
@Deprecated
private
Map
<
Long
,
List
<
Event
>>
getEventTimePatternNew
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
,
boolean
month
)
{
private
Map
<
Long
,
List
<
Event
>>
getEventTimePatternNew
(
ChannelIndex
channelIndex
,
Long
startTime
,
Long
endTime
,
boolean
month
)
{
Map
<
Long
,
List
<
Event
>>
res
=
new
HashMap
<>();
Map
<
Long
,
List
<
Event
>>
res
=
new
HashMap
<>();
String
pattern
;
String
pattern
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDataDaoImpl.java
View file @
28ae2919
...
@@ -58,11 +58,13 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
...
@@ -58,11 +58,13 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
}
}
@Override
@Override
@Deprecated
public
long
getEventArticleCount
(
Event
event
)
{
public
long
getEventArticleCount
(
Event
event
)
{
return
count
(
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
event
.
getId
())),
event
.
getCollectionName
());
return
count
(
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
event
.
getId
())),
event
.
getCollectionName
());
}
}
@Override
@Override
@Deprecated
public
long
getEventArticleWithChannelCount
(
Event
event
,
ChannelIndex
channelIndex
)
{
public
long
getEventArticleWithChannelCount
(
Event
event
,
ChannelIndex
channelIndex
)
{
return
count
(
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
event
.
getId
()).
and
(
"source"
).
is
(
channelIndex
.
getSource
()).
and
(
"realSource"
).
is
(
channelIndex
.
getRealSource
()).
and
(
"platform"
).
is
(
channelIndex
.
getPlatform
())),
event
.
getCollectionName
());
return
count
(
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
event
.
getId
()).
and
(
"source"
).
is
(
channelIndex
.
getSource
()).
and
(
"realSource"
).
is
(
channelIndex
.
getRealSource
()).
and
(
"platform"
).
is
(
channelIndex
.
getPlatform
())),
event
.
getCollectionName
());
}
}
...
@@ -73,6 +75,7 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
...
@@ -73,6 +75,7 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
}
}
@Override
@Override
@Deprecated
public
List
<
EventData
>
findEventDataListByTime
(
String
eventId
,
Date
startTime
,
Date
endTime
,
String
collectionName
)
{
public
List
<
EventData
>
findEventDataListByTime
(
String
eventId
,
Date
startTime
,
Date
endTime
,
String
collectionName
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
eventId
));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
eventId
));
query
.
addCriteria
(
Criteria
.
where
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
query
.
addCriteria
(
Criteria
.
where
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
...
@@ -80,12 +83,14 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
...
@@ -80,12 +83,14 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements Eve
}
}
@Override
@Override
@Deprecated
public
long
findEventDataCount
(
String
eventId
,
String
collectionName
)
{
public
long
findEventDataCount
(
String
eventId
,
String
collectionName
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
eventId
));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"eventId"
).
is
(
eventId
));
return
mongoTemplate
.
count
(
query
,
EventData
.
class
,
collectionName
);
return
mongoTemplate
.
count
(
query
,
EventData
.
class
,
collectionName
);
}
}
@Override
@Override
@Deprecated
public
Set
<
String
>
findEventIdsByChannelFid
(
String
channelFid
,
long
startTime
,
long
endTime
)
{
public
Set
<
String
>
findEventIdsByChannelFid
(
String
channelFid
,
long
startTime
,
long
endTime
)
{
Set
<
String
>
res
=
new
HashSet
<>();
Set
<
String
>
res
=
new
HashSet
<>();
Criteria
criteria
=
Criteria
.
where
(
"channelFid"
).
is
(
channelFid
).
and
(
"eventMapper.startTime"
).
gte
(
startTime
).
lt
(
endTime
);
Criteria
criteria
=
Criteria
.
where
(
"channelFid"
).
is
(
channelFid
).
and
(
"eventMapper.startTime"
).
gte
(
startTime
).
lt
(
endTime
);
...
...
src/main/java/com/zhiwei/brandkbs2/enmus/RoleEnum.java
View file @
28ae2919
...
@@ -22,7 +22,12 @@ public enum RoleEnum {
...
@@ -22,7 +22,12 @@ public enum RoleEnum {
/**
/**
* 客户
* 客户
*/
*/
CUSTOMER
(
4
,
"客户"
);
CUSTOMER
(
4
,
"客户"
),
/**
* 客户
*/
NO_AUTHORISE
(-
1
,
"无需权限"
);
private
final
int
state
;
private
final
int
state
;
private
final
String
name
;
private
final
String
name
;
...
...
src/main/java/com/zhiwei/brandkbs2/interceptor/MainAuthInterceptor.java
View file @
28ae2919
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.interceptor;
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.interceptor;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
...
@@ -46,7 +47,7 @@ public class MainAuthInterceptor implements HandlerInterceptor {
...
@@ -46,7 +47,7 @@ public class MainAuthInterceptor implements HandlerInterceptor {
}
}
}
}
// 不需要验证权限
// 不需要验证权限
if
(
null
==
auth
)
{
if
(
null
==
auth
||
RoleEnum
.
NO_AUTHORISE
==
auth
.
role
()
)
{
return
true
;
return
true
;
}
}
String
token
=
request
.
getHeader
(
"Token"
);
String
token
=
request
.
getHeader
(
"Token"
);
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ExportAppChannelEventDTO.java
View file @
28ae2919
...
@@ -2,7 +2,8 @@ package com.zhiwei.brandkbs2.pojo.dto;
...
@@ -2,7 +2,8 @@ package com.zhiwei.brandkbs2.pojo.dto;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.zhiwei.brandkbs2.enmus.EventTagEnum
;
import
com.zhiwei.brandkbs2.enmus.EventTagEnum
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.ToString
;
import
lombok.ToString
;
...
@@ -39,10 +40,15 @@ public class ExportAppChannelEventDTO {
...
@@ -39,10 +40,15 @@ public class ExportAppChannelEventDTO {
ExportAppChannelEventDTO
dto
=
new
ExportAppChannelEventDTO
();
ExportAppChannelEventDTO
dto
=
new
ExportAppChannelEventDTO
();
dto
.
setStartTime
(
new
Date
(
event
.
getStartTime
()));
dto
.
setStartTime
(
new
Date
(
event
.
getStartTime
()));
dto
.
setEndTime
(
new
Date
(
event
.
getEndTime
()));
dto
.
setEndTime
(
new
Date
(
event
.
getEndTime
()));
dto
.
setTitle
(
event
.
get
Titl
e
());
dto
.
setTitle
(
event
.
get
Nam
e
());
dto
.
setEmotion
(
event
.
getEmotion
());
dto
.
setEmotion
(
event
.
getEmotion
EventTag
().
getName
());
dto
.
setInfluence
(
event
.
getInfluence
());
dto
.
setInfluence
(
event
.
getInfluence
());
dto
.
setEventType
(
event
.
getEventTag
().
getString
(
EventTagEnum
.
EVENT_TYPE
.
getName
()));
dto
.
setEventType
(
null
);
for
(
EventTagBasicInfo
eventTag
:
event
.
getEventTags
())
{
if
(
eventTag
.
getGroupName
().
equals
(
EventTagEnum
.
EVENT_TYPE
.
getName
())){
dto
.
setEventType
(
eventTag
.
getName
());
}
}
return
dto
;
return
dto
;
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/external/BrandkbsHotEventWarn.java
View file @
28ae2919
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
external
;
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
external
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -65,14 +66,16 @@ public class BrandkbsHotEventWarn {
...
@@ -65,14 +66,16 @@ public class BrandkbsHotEventWarn {
public
static
HotEvent
createFromEvent
(
String
type
,
Event
event
)
{
public
static
HotEvent
createFromEvent
(
String
type
,
Event
event
)
{
HotEvent
hotEvent
=
new
HotEvent
();
HotEvent
hotEvent
=
new
HotEvent
();
hotEvent
.
setType
(
type
);
hotEvent
.
setType
(
type
);
hotEvent
.
setTitle
(
event
.
get
Titl
e
());
hotEvent
.
setTitle
(
event
.
get
Nam
e
());
hotEvent
.
setEmotion
(
event
.
getEmotion
());
hotEvent
.
setEmotion
(
event
.
getEmotion
EventTag
().
getName
());
hotEvent
.
setTotalChannelVolume
(
event
.
getTotalChannelVolume
());
hotEvent
.
setTotalChannelVolume
(
event
.
getTotalChannelVolume
());
hotEvent
.
setTotalDisseminationVolume
(
event
.
getTotalDisseminationVolume
());
hotEvent
.
setTotalDisseminationVolume
(
event
.
getTotalDisseminationVolume
());
hotEvent
.
setStartTime
(
event
.
getStartTime
());
hotEvent
.
setStartTime
(
event
.
getStartTime
());
hotEvent
.
setInfluence
(
event
.
getInfluence
());
hotEvent
.
setInfluence
(
event
.
getInfluence
());
List
<
String
>
tagList
=
// List<String> tagList = event.getEventTag().entrySet().stream().filter(entry -> !"情感倾向".equals(entry.getKey()))
event
.
getEventTag
().
entrySet
().
stream
().
filter
(
entry
->
!
"情感倾向"
.
equals
(
entry
.
getKey
())).
map
(
entry
->
String
.
valueOf
(
entry
.
getValue
())).
collect
(
Collectors
.
toList
());
// .map(entry -> String.valueOf(entry.getValue())).collect(Collectors.toList());
List
<
String
>
tagList
=
event
.
getEventTags
().
stream
().
filter
(
eventTagBasicInfo
->
!
"情感倾向"
.
equals
(
eventTagBasicInfo
.
getGroupName
()))
.
map
(
EventTagBasicInfo:
:
getName
).
collect
(
Collectors
.
toList
());
hotEvent
.
setTagList
(
tagList
);
hotEvent
.
setTagList
(
tagList
);
return
hotEvent
;
return
hotEvent
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
28ae2919
...
@@ -32,6 +32,9 @@ import com.zhiwei.brandkbs2.service.ProjectService;
...
@@ -32,6 +32,9 @@ import com.zhiwei.brandkbs2.service.ProjectService;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.commons.lang3.tuple.Pair
;
...
@@ -52,6 +55,7 @@ import org.elasticsearch.search.sort.SortBuilders;
...
@@ -52,6 +55,7 @@ import org.elasticsearch.search.sort.SortBuilders;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.joda.time.Period
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
...
@@ -115,6 +119,9 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -115,6 +119,9 @@ public class ChannelServiceImpl implements ChannelService {
@Resource
(
name
=
"esSearchExecutor"
)
@Resource
(
name
=
"esSearchExecutor"
)
ThreadPoolTaskExecutor
esSearchExecutor
;
ThreadPoolTaskExecutor
esSearchExecutor
;
@Autowired
private
EventClient
eventClient
;
@Override
@Override
public
PageVO
<
JSONObject
>
findChannelList
(
int
page
,
int
size
,
String
contendId
,
String
emotion
,
String
platform
,
public
PageVO
<
JSONObject
>
findChannelList
(
int
page
,
int
size
,
String
contendId
,
String
emotion
,
String
platform
,
Boolean
show
,
String
keyword
,
String
sorter
)
{
Boolean
show
,
String
keyword
,
String
sorter
)
{
...
@@ -229,26 +236,28 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -229,26 +236,28 @@ public class ChannelServiceImpl implements ChannelService {
@Override
@Override
public
PageVO
<
JSONObject
>
findEventList
(
int
page
,
int
size
,
String
channelId
)
{
public
PageVO
<
JSONObject
>
findEventList
(
int
page
,
int
size
,
String
channelId
)
{
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
List
<
String
>
eventIds
=
eventDao
.
getEvents
(
channel
.
getChannelIndex
());
List
<
String
>
eventIds
=
eventClient
.
getEvents
(
channel
.
getChannelIndex
().
getFid
());
Query
query
=
Query
.
query
(
Criteria
.
where
(
"_id"
).
in
(
eventIds
));
long
total
=
eventClient
.
countInEventIds
(
eventIds
);
long
total
=
eventDao
.
count
(
query
);
// mongoUtil.start(page, size, query);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
list
=
eventClient
.
findListInEventIds
(
eventIds
,
page
,
size
);
List
<
Event
>
list
=
eventDao
.
findList
(
query
);
List
<
JSONObject
>
resList
=
new
ArrayList
<>();
List
<
JSONObject
>
resList
=
list
.
stream
().
map
(
event
->
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
resList
=
list
.
stream
().
map
(
event
->
{
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
event
.
getId
());
json
.
put
(
"id"
,
event
.
getId
());
json
.
put
(
"title"
,
event
.
getTitl
e
());
json
.
put
(
"title"
,
event
.
getNam
e
());
json
.
put
(
"startTime"
,
event
.
getStartTime
());
json
.
put
(
"startTime"
,
event
.
getStartTime
());
json
.
put
(
"emotion"
,
event
.
getEmotion
());
json
.
put
(
"emotion"
,
event
.
getEmotionEventTag
().
getName
());
Query
query1
=
new
Query
();
// Query query1 = new Query();
query1
.
addCriteria
(
Criteria
.
where
(
"eventId"
).
is
(
event
.
getId
()));
// query1.addCriteria(Criteria.where("eventId").is(event.getId()));
json
.
put
(
"total"
,
eventDataDao
.
count
(
query1
,
event
.
getCollectionName
()));
json
.
put
(
"total"
,
eventClient
.
countEventDataByEventId
(
event
));
query1
.
addCriteria
(
channelDao
.
addChannelIndex
(
channel
.
getChannelIndex
()));
// query1.addCriteria(channelDao.addChannelIndex(channel.getChannelIndex()));
json
.
put
(
"channelTotal"
,
eventDataDao
.
count
(
query1
,
event
.
getCollectionName
()));
// query1.addCriteria(Criteria.where("eventBrandkbsChannels.channelFid").is(channel.getChannelIndex().getFid()));
json
.
put
(
"channelTotal"
,
eventClient
.
countEventDataByEventIdAndFid
(
event
,
channel
.
getChannelIndex
().
getFid
()));
return
json
;
return
json
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
MongoUtil
.
PageHelper
<
JSONObject
>
pageHelper
=
mongoUtil
.
pageHelper
(
total
,
resList
);
}
return
PageVO
.
createPageVo
(
pageHelper
,
resList
);
return
PageVO
.
createPageVo
(
total
,
page
,
size
,
resList
);
}
}
@Override
@Override
...
@@ -327,24 +336,30 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -327,24 +336,30 @@ public class ChannelServiceImpl implements ChannelService {
public
List
<
ExportAdminChannelEventDTO
>
findDownloadChannelEventList
(
String
channelId
)
{
public
List
<
ExportAdminChannelEventDTO
>
findDownloadChannelEventList
(
String
channelId
)
{
List
<
ExportAdminChannelEventDTO
>
resList
=
new
ArrayList
<>();
List
<
ExportAdminChannelEventDTO
>
resList
=
new
ArrayList
<>();
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
List
<
String
>
eventIds
=
event
Dao
.
getEvents
(
channel
.
getChannelIndex
());
List
<
String
>
eventIds
=
event
Client
.
getEvents
(
channel
.
getChannelIndex
().
getFid
());
if
(
CollectionUtils
.
isEmpty
(
eventIds
))
{
if
(
CollectionUtils
.
isEmpty
(
eventIds
))
{
return
resList
;
return
resList
;
}
}
List
<
Event
>
events
=
eventDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"_id"
).
in
(
eventIds
))
);
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
events
=
eventClient
.
findListInEventIds
(
eventIds
);
return
events
.
stream
().
map
(
event
->
{
return
events
.
stream
().
map
(
event
->
{
ExportAdminChannelEventDTO
dto
=
Tools
.
convertMap
(
event
,
ExportAdminChannelEventDTO
.
class
);
ExportAdminChannelEventDTO
dto
=
Tools
.
convertMap
(
event
,
ExportAdminChannelEventDTO
.
class
);
dto
.
setTitle
(
event
.
getName
());
// 首发信息
// 首发信息
EventData
firstData
=
eventDataDao
.
findFirstData
(
event
.
getId
(),
event
.
getCollectionName
()
);
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventData
firstData
=
event
.
getOriginArticle
(
);
if
(
null
!=
firstData
)
{
if
(
null
!=
firstData
)
{
dto
.
setFirstPlatform
(
firstData
.
getPlatform
());
dto
.
setFirstPlatform
(
firstData
.
getPlatform
());
dto
.
setFirstRealSource
(
firstData
.
getRealSource
());
dto
.
setFirstRealSource
(
firstData
.
getRealSource
());
dto
.
setFirstSource
(
firstData
.
getSource
());
dto
.
setFirstSource
(
firstData
.
getSource
());
}
}
dto
.
setEventArticleCount
(
eventDataDao
.
getEventArticleCount
(
event
));
dto
.
setEventArticleCount
(
eventClient
.
getEventArticleCount
(
event
));
dto
.
setChannelArticleCount
(
ChannelIndex
channelIndex
=
Tools
.
convertMap
(
channel
,
ChannelIndex
.
class
);
eventDataDao
.
getEventArticleWithChannelCount
(
event
,
Tools
.
convertMap
(
channel
,
ChannelIndex
.
class
)));
dto
.
setChannelArticleCount
(
eventClient
.
getEventArticleWithChannelCount
(
event
,
channelIndex
.
getSource
(),
channelIndex
.
getRealSource
(),
channelIndex
.
getPlatform
()));
dto
.
setEventType
(
event
.
getEventTag
().
getString
(
EventTagEnum
.
EVENT_TYPE
.
getName
()));
dto
.
setEventType
(
null
);
for
(
EventTagBasicInfo
eventTag
:
event
.
getEventTags
())
{
if
(
eventTag
.
getGroupName
().
equals
(
EventTagEnum
.
EVENT_TYPE
.
getName
())){
dto
.
setEventType
(
eventTag
.
getName
());
}
}
return
dto
;
return
dto
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
...
@@ -661,8 +676,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -661,8 +676,7 @@ public class ChannelServiceImpl implements ChannelService {
}
}
// 根据品牌分类
// 根据品牌分类
List
<
String
>
contendList
=
Arrays
.
asList
(
contends
.
split
(
","
));
List
<
String
>
contendList
=
Arrays
.
asList
(
contends
.
split
(
","
));
Map
<
String
,
List
<
ChannelIndex
.
Article
>>
contendMap
=
getSourceContendMap
(
channelId
,
contendList
,
startTime
,
Map
<
String
,
List
<
ChannelIndex
.
Article
>>
contendMap
=
getSourceContendMap
(
channelId
,
contendList
,
startTime
,
endTime
);
endTime
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
long
articleTotal
=
0
;
long
articleTotal
=
0
;
long
eventTotal
=
0
;
long
eventTotal
=
0
;
...
@@ -768,13 +782,13 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -768,13 +782,13 @@ public class ChannelServiceImpl implements ChannelService {
return
dayResult
;
return
dayResult
;
}
}
private
JSONObject
getDayResultWithEvent
(
List
<
Event
>
list
,
int
page
,
int
pageSize
,
Long
time
)
{
private
JSONObject
getDayResultWithEvent
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
list
,
int
page
,
int
pageSize
,
Long
time
)
{
JSONObject
dayResult
=
new
JSONObject
();
JSONObject
dayResult
=
new
JSONObject
();
List
<
JSONObject
>
collect
=
list
.
stream
().
skip
((
long
)
(
page
-
1
)
*
pageSize
).
limit
(
pageSize
).
map
(
event
->
{
List
<
JSONObject
>
collect
=
list
.
stream
().
skip
((
long
)
(
page
-
1
)
*
pageSize
).
limit
(
pageSize
).
map
(
event
->
{
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
event
.
getId
());
json
.
put
(
"id"
,
event
.
getId
());
json
.
put
(
"emotion"
,
event
.
getEmotion
());
json
.
put
(
"emotion"
,
event
.
getEmotion
EventTag
().
getName
());
json
.
put
(
"title"
,
event
.
get
Titl
e
());
json
.
put
(
"title"
,
event
.
get
Nam
e
());
json
.
put
(
"influence"
,
event
.
getInfluence
());
json
.
put
(
"influence"
,
event
.
getInfluence
());
return
json
;
return
json
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -805,8 +819,8 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -805,8 +819,8 @@ public class ChannelServiceImpl implements ChannelService {
JSONObject
res
=
new
JSONObject
();
JSONObject
res
=
new
JSONObject
();
List
<
JSONObject
>
dayList
=
new
ArrayList
<>();
List
<
JSONObject
>
dayList
=
new
ArrayList
<>();
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Map
<
Long
,
List
<
Event
>>
eventDay
=
eventDao
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
Map
<
Long
,
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>>
eventDay
=
endTime
);
e
ventClient
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(),
startTime
,
e
ndTime
);
eventDay
=
Tools
.
sortTimeKeyMap
(
eventDay
,
true
);
eventDay
=
Tools
.
sortTimeKeyMap
(
eventDay
,
true
);
eventDay
.
forEach
((
time
,
list
)
->
dayList
.
add
(
getDayResultWithEvent
(
list
,
page
,
pageSize
,
time
)));
eventDay
.
forEach
((
time
,
list
)
->
dayList
.
add
(
getDayResultWithEvent
(
list
,
page
,
pageSize
,
time
)));
res
.
put
(
"list"
,
dayList
);
res
.
put
(
"list"
,
dayList
);
...
@@ -818,8 +832,8 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -818,8 +832,8 @@ public class ChannelServiceImpl implements ChannelService {
String
contendId
)
{
String
contendId
)
{
List
<
ExportAppChannelEventDTO
>
res
=
new
ArrayList
<>();
List
<
ExportAppChannelEventDTO
>
res
=
new
ArrayList
<>();
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Channel
channel
=
channelDao
.
findOneById
(
channelId
);
Map
<
Long
,
List
<
Event
>>
eventDay
=
eventDao
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
Map
<
Long
,
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>>
eventDay
=
endTime
);
e
ventClient
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(),
startTime
,
e
ndTime
);
Tools
.
sortTimeKeyMap
(
eventDay
,
true
).
values
().
forEach
(
events
->
{
Tools
.
sortTimeKeyMap
(
eventDay
,
true
).
values
().
forEach
(
events
->
{
events
.
forEach
(
event
->
{
events
.
forEach
(
event
->
{
res
.
add
(
ExportAppChannelEventDTO
.
createFromEvent
(
event
));
res
.
add
(
ExportAppChannelEventDTO
.
createFromEvent
(
event
));
...
@@ -849,10 +863,10 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -849,10 +863,10 @@ public class ChannelServiceImpl implements ChannelService {
// 是否友好渠道
// 是否友好渠道
boolean
isPositive
=
false
;
boolean
isPositive
=
false
;
boolean
isNegative
=
false
;
boolean
isNegative
=
false
;
long
specNegativeCount
=
event
Dao
.
getEventCount
(
new
ChannelIndex
(
channel
),
long
specNegativeCount
=
event
Client
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(
),
Arrays
.
asList
(
EmotionEnum
.
POSITIVE
.
getName
(),
EmotionEnum
.
NEUTRAL
.
getName
()),
Arrays
.
asList
(
EmotionEnum
.
POSITIVE
.
getName
(),
EmotionEnum
.
NEUTRAL
.
getName
()),
EmotionEnum
.
NEGATIVE
.
getName
());
EmotionEnum
.
NEGATIVE
.
getName
());
long
specPositiveCount
=
event
Dao
.
getEventCount
(
new
ChannelIndex
(
channel
),
long
specPositiveCount
=
event
Client
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(
),
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
EmotionEnum
.
POSITIVE
.
getName
());
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
EmotionEnum
.
POSITIVE
.
getName
());
// 特殊情况:若皆有发布过反常稿件
// 特殊情况:若皆有发布过反常稿件
if
(
specNegativeCount
>
0
&&
specPositiveCount
>
0
)
{
if
(
specNegativeCount
>
0
&&
specPositiveCount
>
0
)
{
...
@@ -1114,7 +1128,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1114,7 +1128,7 @@ public class ChannelServiceImpl implements ChannelService {
}
}
channel
.
setEmotionIndex
(
index
);
channel
.
setEmotionIndex
(
index
);
channel
.
setEmotion
(
emotion
);
channel
.
setEmotion
(
emotion
);
channel
.
setEventCount
(
event
Dao
.
getEvents
(
new
ChannelIndex
(
channel
)).
size
());
channel
.
setEventCount
(
event
Client
.
getEvents
(
new
ChannelIndex
(
channel
).
getFid
(
)).
size
());
}
}
/**
/**
...
@@ -1138,7 +1152,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1138,7 +1152,7 @@ public class ChannelServiceImpl implements ChannelService {
// 正面-负面得分
// 正面-负面得分
double
negativeScore
=
this
.
getNegativeScore
(
value
);
double
negativeScore
=
this
.
getNegativeScore
(
value
);
// 正面事件
// 正面事件
value
=
event
Dao
.
getEventCount
(
new
ChannelIndex
(
channel
),
value
=
event
Client
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(
),
Collections
.
singletonList
(
EmotionEnum
.
POSITIVE
.
getName
()),
null
);
Collections
.
singletonList
(
EmotionEnum
.
POSITIVE
.
getName
()),
null
);
// 正面事件得分
// 正面事件得分
double
positiveEventScore
=
this
.
getPositiveEventScore
(
value
);
double
positiveEventScore
=
this
.
getPositiveEventScore
(
value
);
...
@@ -1315,7 +1329,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1315,7 +1329,7 @@ public class ChannelServiceImpl implements ChannelService {
// 负面稿件数得分
// 负面稿件数得分
double
negativeArticlesScore
=
this
.
getNegativeArticlesScore
(
value
);
double
negativeArticlesScore
=
this
.
getNegativeArticlesScore
(
value
);
// 参与负面事件
// 参与负面事件
value
=
event
Dao
.
getEventCount
(
channel
,
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
null
);
value
=
event
Client
.
getEventCount
(
channel
.
getFid
()
,
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
null
);
// 参与负面事件得分
// 参与负面事件得分
double
negativeEventScore
=
this
.
getNegativeEventScore
(
value
);
double
negativeEventScore
=
this
.
getNegativeEventScore
(
value
);
// 特殊稿件
// 特殊稿件
...
@@ -1436,8 +1450,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1436,8 +1450,7 @@ public class ChannelServiceImpl implements ChannelService {
}
}
private
double
inEventCountMonthAverage
(
Channel
channel
,
String
eventEmotion
)
{
private
double
inEventCountMonthAverage
(
Channel
channel
,
String
eventEmotion
)
{
long
eventCount
=
eventDao
.
getEventCount
(
new
ChannelIndex
(
channel
),
Collections
.
singletonList
(
eventEmotion
),
long
eventCount
=
eventClient
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(),
Collections
.
singletonList
(
eventEmotion
),
null
);
null
);
Period
periodDays
=
new
Period
(
channel
.
getCTime
(),
System
.
currentTimeMillis
(),
PeriodType
.
months
());
Period
periodDays
=
new
Period
(
channel
.
getCTime
(),
System
.
currentTimeMillis
(),
PeriodType
.
months
());
return
(
double
)
eventCount
/
periodDays
.
getMonths
();
return
(
double
)
eventCount
/
periodDays
.
getMonths
();
}
}
...
@@ -1497,22 +1510,22 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1497,22 +1510,22 @@ public class ChannelServiceImpl implements ChannelService {
private
Pair
<
Long
,
JSONObject
>
getEventCount
(
Long
startTime
,
Long
endTime
,
Channel
channel
,
String
contendId
)
{
private
Pair
<
Long
,
JSONObject
>
getEventCount
(
Long
startTime
,
Long
endTime
,
Channel
channel
,
String
contendId
)
{
JSONObject
res
=
new
JSONObject
();
JSONObject
res
=
new
JSONObject
();
Map
<
Long
,
List
<
Event
>>
eventCount
;
Map
<
Long
,
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>>
eventCount
;
if
(
endTime
-
startTime
>
Constant
.
ONE_MONTH
)
{
if
(
endTime
-
startTime
>
Constant
.
ONE_MONTH
)
{
eventCount
=
event
Dao
.
getEventMonth
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
endTime
);
eventCount
=
event
Client
.
getEventMonth
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(
),
startTime
,
endTime
);
}
else
{
}
else
{
eventCount
=
event
Dao
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
endTime
);
eventCount
=
event
Client
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(
),
startTime
,
endTime
);
}
}
// 事件部分
// 事件部分
long
positiveEventCount
=
0
;
long
positiveEventCount
=
0
;
long
negativeEventCount
=
0
;
long
negativeEventCount
=
0
;
long
totalEvent
=
0
;
long
totalEvent
=
0
;
// 统计参与事件
// 统计参与事件
for
(
List
<
Event
>
events
:
eventCount
.
values
())
{
for
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
events
:
eventCount
.
values
())
{
for
(
Event
event
:
events
)
{
for
(
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
event
:
events
)
{
if
(
EmotionEnum
.
NEGATIVE
.
getName
().
equals
(
event
.
getEmotion
()))
{
if
(
EmotionEnum
.
NEGATIVE
.
getName
().
equals
(
event
.
getEmotion
EventTag
().
getName
()))
{
negativeEventCount
++;
negativeEventCount
++;
}
else
if
(
EmotionEnum
.
POSITIVE
.
getName
().
equals
(
event
.
getEmotion
()))
{
}
else
if
(
EmotionEnum
.
POSITIVE
.
getName
().
equals
(
event
.
getEmotion
EventTag
().
getName
()))
{
positiveEventCount
++;
positiveEventCount
++;
}
}
totalEvent
++;
totalEvent
++;
...
@@ -1536,13 +1549,12 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1536,13 +1549,12 @@ public class ChannelServiceImpl implements ChannelService {
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
private
List
<
JSONObject
>
spreadingTendEvent
(
Long
startTime
,
Long
endTime
,
Channel
channel
,
String
contendId
,
private
List
<
JSONObject
>
spreadingTendEvent
(
Long
startTime
,
Long
endTime
,
Channel
channel
,
String
contendId
,
String
timePattern
)
{
String
timePattern
)
{
Map
<
Long
,
List
<
Event
>>
eventCount
=
completeTimes
(
startTime
,
endTime
,
timePattern
);
Map
<
Long
,
List
<
Event
>>
eventCount
=
completeTimes
(
startTime
,
endTime
,
timePattern
);
if
(
Constant
.
MONTH_PATTERN
.
equals
(
timePattern
))
{
if
(
Constant
.
MONTH_PATTERN
.
equals
(
timePattern
))
{
eventCount
.
putAll
(
event
Dao
.
getEventMonth
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
endTime
));
eventCount
.
putAll
(
event
Client
.
getEventMonth
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(
),
startTime
,
endTime
));
}
else
{
}
else
{
eventCount
.
putAll
(
event
Dao
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
),
startTime
,
endTime
));
eventCount
.
putAll
(
event
Client
.
getEventDay
(
new
ChannelIndex
(
channel
,
contendId
).
getFid
(
),
startTime
,
endTime
));
}
}
return
eventCount
.
entrySet
().
stream
().
sorted
(
Comparator
.
comparingLong
(
Map
.
Entry
::
getKey
)).
map
(
e
->
{
return
eventCount
.
entrySet
().
stream
().
sorted
(
Comparator
.
comparingLong
(
Map
.
Entry
::
getKey
)).
map
(
e
->
{
JSONObject
spreadJson
=
new
JSONObject
();
JSONObject
spreadJson
=
new
JSONObject
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
View file @
28ae2919
...
@@ -127,7 +127,7 @@ public class CommonServiceImpl implements CommonService {
...
@@ -127,7 +127,7 @@ public class CommonServiceImpl implements CommonService {
@Override
@Override
public
Long
[]
getTimeRangeDay
()
{
public
Long
[]
getTimeRangeDay
()
{
long
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
long
endTime
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
).
getTime
();
long
startTime
=
DateUtils
.
addDays
(
new
Date
(
endTime
),
-
1
).
getTime
();
long
startTime
=
DateUtils
.
addDays
(
new
Date
(
endTime
),
-
1
).
getTime
();
return
new
Long
[]{
startTime
,
endTime
};
return
new
Long
[]{
startTime
,
endTime
};
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
View file @
28ae2919
...
@@ -19,12 +19,14 @@ import com.zhiwei.brandkbs2.service.MarkDataService;
...
@@ -19,12 +19,14 @@ import com.zhiwei.brandkbs2.service.MarkDataService;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.Period
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -61,6 +63,9 @@ public class IndexServiceImpl implements IndexService {
...
@@ -61,6 +63,9 @@ public class IndexServiceImpl implements IndexService {
@Resource
@Resource
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
private
EventClient
eventClient
;
@Override
@Override
public
JSONObject
getYuqingAmount
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
public
JSONObject
getYuqingAmount
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
if
(
null
==
startTime
||
null
==
endTime
)
{
if
(
null
==
startTime
||
null
==
endTime
)
{
...
@@ -184,11 +189,10 @@ public class IndexServiceImpl implements IndexService {
...
@@ -184,11 +189,10 @@ public class IndexServiceImpl implements IndexService {
Long
oldStartTime
=
startTime
-
(
endTime
-
startTime
);
Long
oldStartTime
=
startTime
-
(
endTime
-
startTime
);
int
selectMonths
=
new
Period
(
startTime
,
endTime
,
PeriodType
.
months
()).
getMonths
();
int
selectMonths
=
new
Period
(
startTime
,
endTime
,
PeriodType
.
months
()).
getMonths
();
selectMonths
=
0
==
selectMonths
?
1
:
selectMonths
;
selectMonths
=
0
==
selectMonths
?
1
:
selectMonths
;
long
total
=
eventDao
.
getEventCountByProjectIdAndContendId
(
null
,
null
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
);
// 调用事件中间件时,主品牌id使用项目id
long
eventTotal
=
eventDao
.
getEventCountByProjectIdAndContendId
long
total
=
eventClient
.
getEventCountByProjectIdAndContendId
(
null
,
null
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
);
long
eventTotal
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
oldEventTotal
=
eventDao
.
getEventCountByProjectIdAndContendId
long
oldEventTotal
=
eventClient
.
getEventCountByProjectIdAndContendId
(
oldStartTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
(
oldStartTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
);
jsonObject
.
put
(
"eventTotal"
,
eventTotal
);
jsonObject
.
put
(
"eventTotal"
,
eventTotal
);
jsonObject
.
put
(
"avgEventTotal"
,
total
*
selectMonths
/
(
totalMonths
+
1
));
jsonObject
.
put
(
"avgEventTotal"
,
total
*
selectMonths
/
(
totalMonths
+
1
));
jsonObject
.
put
(
"compare"
,
oldEventTotal
==
0
?
0
d
:
(
eventTotal
-
oldEventTotal
)
/
(
double
)
oldEventTotal
);
jsonObject
.
put
(
"compare"
,
oldEventTotal
==
0
?
0
d
:
(
eventTotal
-
oldEventTotal
)
/
(
double
)
oldEventTotal
);
...
@@ -418,12 +422,14 @@ public class IndexServiceImpl implements IndexService {
...
@@ -418,12 +422,14 @@ public class IndexServiceImpl implements IndexService {
*/
*/
private
JSONObject
getTopEvent
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
)
{
private
JSONObject
getTopEvent
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
)
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
List
<
Event
>
eventList
=
eventDao
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
,
1
);
contendId
=
Objects
.
equals
(
contendId
,
Constant
.
PRIMARY_CONTEND_ID
)
?
projectId
:
contendId
;
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
eventList
=
eventClient
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
eventList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
eventList
))
{
Event
event
=
eventList
.
get
(
0
);
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
event
=
eventList
.
get
(
0
);
long
articleCount
=
event
DataDao
.
getEventArticleCount
(
event
);
long
articleCount
=
event
Client
.
getEventArticleCount
(
event
);
result
.
put
(
"id"
,
event
.
getId
());
result
.
put
(
"id"
,
event
.
getId
());
result
.
put
(
"title"
,
event
.
get
Titl
e
());
result
.
put
(
"title"
,
event
.
get
Nam
e
());
result
.
put
(
"influence"
,
event
.
getInfluence
());
result
.
put
(
"influence"
,
event
.
getInfluence
());
result
.
put
(
"articleCount"
,
articleCount
);
result
.
put
(
"articleCount"
,
articleCount
);
}
}
...
@@ -535,7 +541,8 @@ public class IndexServiceImpl implements IndexService {
...
@@ -535,7 +541,8 @@ public class IndexServiceImpl implements IndexService {
result
.
put
(
"normalCount"
,
normalCount
);
result
.
put
(
"normalCount"
,
normalCount
);
result
.
put
(
"time"
,
startTime
);
result
.
put
(
"time"
,
startTime
);
//统计时间段总事件数
//统计时间段总事件数
long
eventCount
=
eventDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
"0"
);
// 调用事件中间件时,主品牌id使用项目id
long
eventCount
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
result
.
put
(
"eventCount"
,
eventCount
);
result
.
put
(
"eventCount"
,
eventCount
);
lineList
.
add
(
result
);
lineList
.
add
(
result
);
}
}
...
@@ -556,10 +563,11 @@ public class IndexServiceImpl implements IndexService {
...
@@ -556,10 +563,11 @@ public class IndexServiceImpl implements IndexService {
Long
startTime
=
map
.
get
(
"startTime"
);
Long
startTime
=
map
.
get
(
"startTime"
);
Long
endTime
=
map
.
get
(
"endTime"
);
Long
endTime
=
map
.
get
(
"endTime"
);
//统计时间段总事件数
//统计时间段总事件数
long
totalEventCount
=
eventDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
);
// 调用事件中间件时,主品牌id使用项目id
long
posEventCount
=
eventDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
contendId
);
long
totalEventCount
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
neuEventCount
=
eventDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
contendId
);
long
posEventCount
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
);
long
negEventCount
=
eventDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
contendId
);
long
neuEventCount
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
);
long
negEventCount
=
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
);
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"totalCount"
,
totalEventCount
);
result
.
put
(
"totalCount"
,
totalEventCount
);
result
.
put
(
"posCount"
,
posEventCount
);
result
.
put
(
"posCount"
,
posEventCount
);
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
View file @
28ae2919
...
@@ -18,6 +18,9 @@ import com.zhiwei.brandkbs2.service.ProjectService;
...
@@ -18,6 +18,9 @@ import com.zhiwei.brandkbs2.service.ProjectService;
import
com.zhiwei.brandkbs2.service.ProjectWarnService
;
import
com.zhiwei.brandkbs2.service.ProjectWarnService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -78,6 +81,9 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -78,6 +81,9 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
@Resource
(
name
=
"redisUtil"
)
@Resource
(
name
=
"redisUtil"
)
RedisUtil
redisUtil
;
RedisUtil
redisUtil
;
@Autowired
private
EventClient
eventClient
;
private
static
final
Map
<
String
,
String
>
TYPE_SEARCH
=
new
HashMap
<>();
private
static
final
Map
<
String
,
String
>
TYPE_SEARCH
=
new
HashMap
<>();
static
{
static
{
...
@@ -297,7 +303,7 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -297,7 +303,7 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
return
new
BrandkbsWarnTemplate
(
firstCount
,
key1
,
key2
,
key3
,
key4
,
new
BrandkbsYuQingWarn
(
collect
));
return
new
BrandkbsWarnTemplate
(
firstCount
,
key1
,
key2
,
key3
,
key4
,
new
BrandkbsYuQingWarn
(
collect
));
}
}
private
BrandkbsWarnTemplate
brandkbsWarnTemplate4HotEvent
(
BrandkbsHotEventConfig
config
,
Map
<
String
,
List
<
Event
>>
eventMap
,
long
start
,
long
end
,
AbstractProject
project
)
{
private
BrandkbsWarnTemplate
brandkbsWarnTemplate4HotEvent
(
BrandkbsHotEventConfig
config
,
Map
<
String
,
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>>
eventMap
,
long
start
,
long
end
,
AbstractProject
project
)
{
int
firstCount
=
eventMap
.
values
().
stream
().
mapToInt
(
List:
:
size
).
sum
();
int
firstCount
=
eventMap
.
values
().
stream
().
mapToInt
(
List:
:
size
).
sum
();
if
(
firstCount
==
0
)
{
if
(
firstCount
==
0
)
{
return
null
;
return
null
;
...
@@ -313,17 +319,17 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -313,17 +319,17 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
final
int
limit
=
2
;
final
int
limit
=
2
;
int
count
=
limit
;
int
count
=
limit
;
out:
out:
for
(
List
<
Event
>
value
:
eventMap
.
values
())
{
for
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
value
:
eventMap
.
values
())
{
for
(
Event
event
:
value
)
{
for
(
Event
event
:
value
)
{
if
(--
count
==
0
)
{
if
(--
count
==
0
)
{
if
(
firstCount
<=
limit
)
{
if
(
firstCount
<=
limit
)
{
keyBuilder4
.
append
(
event
.
get
Titl
e
());
keyBuilder4
.
append
(
event
.
get
Nam
e
());
}
else
{
}
else
{
keyBuilder4
.
append
(
event
.
get
Titl
e
()).
append
(
"\r\n"
);
keyBuilder4
.
append
(
event
.
get
Nam
e
()).
append
(
"\r\n"
);
}
}
break
out
;
break
out
;
}
else
{
}
else
{
keyBuilder4
.
append
(
event
.
get
Titl
e
()).
append
(
"\r\n"
);
keyBuilder4
.
append
(
event
.
get
Nam
e
()).
append
(
"\r\n"
);
}
}
}
}
}
}
...
@@ -332,7 +338,8 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -332,7 +338,8 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
}
else
{
}
else
{
key4
=
keyBuilder4
.
toString
();
key4
=
keyBuilder4
.
toString
();
}
}
Map
<
String
,
List
<
BrandkbsHotEventWarn
.
HotEvent
>>
collect
=
eventMap
.
entrySet
().
stream
().
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
entry
->
entry
.
getValue
().
stream
().
map
(
event
->
BrandkbsHotEventWarn
.
HotEvent
.
createFromEvent
(
entry
.
getKey
(),
event
)).
collect
(
Collectors
.
toList
())));
Map
<
String
,
List
<
BrandkbsHotEventWarn
.
HotEvent
>>
collect
=
eventMap
.
entrySet
().
stream
().
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
entry
->
entry
.
getValue
()
.
stream
().
map
(
event
->
BrandkbsHotEventWarn
.
HotEvent
.
createFromEvent
(
entry
.
getKey
(),
event
)).
collect
(
Collectors
.
toList
())));
// List<BrandkbsHotEventWarn.HotEvent> collect = eventMap.entrySet().stream().map(entry -> entry.getValue().stream().
// List<BrandkbsHotEventWarn.HotEvent> collect = eventMap.entrySet().stream().map(entry -> entry.getValue().stream().
// map(event -> BrandkbsHotEventWarn.HotEvent.createFromEvent(entry.getKey(), event)).collect(Collectors.toList())).
// map(event -> BrandkbsHotEventWarn.HotEvent.createFromEvent(entry.getKey(), event)).collect(Collectors.toList())).
// collect(Collectors.toList()).stream().flatMap(List::stream).collect(Collectors.toList());
// collect(Collectors.toList()).stream().flatMap(List::stream).collect(Collectors.toList());
...
@@ -718,30 +725,39 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -718,30 +725,39 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
long
start
=
end
-
Constant
.
ONE_DAY
*
7
;
long
start
=
end
-
Constant
.
ONE_DAY
*
7
;
try
{
try
{
log
.
info
(
"获取热点事件预警开始,project:{}"
,
project
.
getProjectName
());
log
.
info
(
"获取热点事件预警开始,project:{}"
,
project
.
getProjectName
());
Map
<
String
,
List
<
Event
>>
eventMap
=
new
LinkedHashMap
<>();
Map
<
String
,
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>>
eventMap
=
new
LinkedHashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getOwnEvent
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getOwnEvent
()))
{
List
<
Event
>
ownEvents
=
eventDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
"0"
,
config
.
getEventTop
());
// 调用事件中间件时,使用项目id作为主品牌id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
ownEvents
=
eventClient
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
projectId
,
config
.
getEventTop
());
eventMap
.
put
(
"品牌动态"
,
ownEvents
);
eventMap
.
put
(
"品牌动态"
,
ownEvents
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getContendsEvent
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getContendsEvent
()))
{
List
<
Event
>
contentEvents
=
new
ArrayList
<>();
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
contentEvents
=
new
ArrayList
<>();
for
(
String
contendId
:
config
.
getContendsEvent
())
{
for
(
String
contendId
:
config
.
getContendsEvent
())
{
contentEvents
.
addAll
(
eventDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
contendId
,
config
.
getEventTop
()));
contendId
=
Objects
.
equals
(
Constant
.
PRIMARY_CONTEND_ID
,
contendId
)
?
projectId
:
contendId
;
contentEvents
.
addAll
(
eventClient
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
contendId
,
config
.
getEventTop
()));
}
}
eventMap
.
put
(
"友商动态"
,
contentEvents
);
eventMap
.
put
(
"友商动态"
,
contentEvents
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getZhiWeiEvent
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getZhiWeiEvent
()))
{
List
<
Event
>
externalEvents
=
new
ArrayList
<>();
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
externalEvents
=
new
ArrayList
<>();
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
getExternalFilterNewUrl
,
String
.
class
,
config
.
getZhiWeiEvent
().
toArray
(),
start
,
end
);
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
getExternalFilterNewUrl
,
String
.
class
,
config
.
getZhiWeiEvent
().
toArray
(),
start
,
end
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
forEntity
.
getBody
());
JSONObject
jsonObject
=
JSON
.
parseObject
(
forEntity
.
getBody
());
JSONArray
jsonArray
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONArray
(
"events"
);
JSONArray
jsonArray
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONArray
(
"events"
);
for
(
int
i
=
0
;
i
<
config
.
getEventTop
();
i
++)
{
for
(
int
i
=
0
;
i
<
config
.
getEventTop
();
i
++)
{
JSONObject
zhiweiEvent
=
jsonArray
.
getJSONObject
(
i
);
JSONObject
zhiweiEvent
=
jsonArray
.
getJSONObject
(
i
);
Event
event
=
new
Event
();
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
event
=
new
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
();
event
.
setTitle
(
zhiweiEvent
.
getString
(
"eventname"
));
event
.
setName
(
zhiweiEvent
.
getString
(
"eventname"
));
JSONObject
eventTag
=
new
JSONObject
();
// JSONObject eventTag = new JSONObject();
eventTag
.
put
(
"事件类型"
,
zhiweiEvent
.
getString
(
"type"
));
// eventTag.put("事件类型", zhiweiEvent.getString("type"));
event
.
setEventTag
(
eventTag
);
// event.setEventTag(eventTag);
EventTagBasicInfo
eventTagBasicInfo
=
new
EventTagBasicInfo
();
eventTagBasicInfo
.
setGroupName
(
"事件类型"
);
eventTagBasicInfo
.
setName
(
zhiweiEvent
.
getString
(
"type"
));
List
<
EventTagBasicInfo
>
infos
=
new
ArrayList
<>(
1
);
infos
.
add
(
eventTagBasicInfo
);
event
.
setEventTags
(
infos
);
event
.
setTotalDisseminationVolume
(
zhiweiEvent
.
getLong
(
"allCount"
));
event
.
setTotalDisseminationVolume
(
zhiweiEvent
.
getLong
(
"allCount"
));
event
.
setStartTime
(
zhiweiEvent
.
getLong
(
"startTime"
));
event
.
setStartTime
(
zhiweiEvent
.
getLong
(
"startTime"
));
event
.
setInfluence
(
zhiweiEvent
.
getDouble
(
"index"
));
event
.
setInfluence
(
zhiweiEvent
.
getDouble
(
"index"
));
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
28ae2919
...
@@ -28,6 +28,8 @@ import com.zhiwei.brandkbs2.service.ReportService;
...
@@ -28,6 +28,8 @@ import com.zhiwei.brandkbs2.service.ReportService;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
@@ -86,6 +88,9 @@ public class ReportServiceImpl implements ReportService {
...
@@ -86,6 +88,9 @@ public class ReportServiceImpl implements ReportService {
@Autowired
@Autowired
StringRedisTemplate
stringRedisTemplate
;
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
EventClient
eventClient
;
@Override
@Override
public
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
()
{
public
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
()
{
Map
<
String
,
ReportSettingsDTO
>
res
=
new
HashMap
<>();
Map
<
String
,
ReportSettingsDTO
>
res
=
new
HashMap
<>();
...
@@ -348,7 +353,9 @@ public class ReportServiceImpl implements ReportService {
...
@@ -348,7 +353,9 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"curPosTotal"
,
curPositiveTotal
);
result
.
put
(
"curPosTotal"
,
curPositiveTotal
);
result
.
put
(
"curPosPro"
,
curTotal
==
0
?
0
:
curPositiveTotal
*
1.0
/
curTotal
);
result
.
put
(
"curPosPro"
,
curTotal
==
0
?
0
:
curPositiveTotal
*
1.0
/
curTotal
);
//正面事件传播量top
//正面事件传播量top
List
<
Event
>
topPosEventList
=
eventDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
contendId
,
3
);
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topPosEventList
=
eventClient
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
,
3
);
if
(
CollectionUtils
.
isEmpty
(
topPosEventList
))
{
if
(
CollectionUtils
.
isEmpty
(
topPosEventList
))
{
List
<
Map
.
Entry
<
String
,
Integer
>>
topPosArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
3
);
List
<
Map
.
Entry
<
String
,
Integer
>>
topPosArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
3
);
result
.
put
(
"topPosSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topPosArticleList
));
result
.
put
(
"topPosSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topPosArticleList
));
...
@@ -364,7 +371,9 @@ public class ReportServiceImpl implements ReportService {
...
@@ -364,7 +371,9 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"curNeuTotal"
,
curNeutralTotal
);
result
.
put
(
"curNeuTotal"
,
curNeutralTotal
);
result
.
put
(
"curNeuPro"
,
curTotal
==
0
?
0
:
curNeutralTotal
*
1.0
/
curTotal
);
result
.
put
(
"curNeuPro"
,
curTotal
==
0
?
0
:
curNeutralTotal
*
1.0
/
curTotal
);
//中性事件传播量top
//中性事件传播量top
List
<
Event
>
topNeuEventList
=
eventDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
contendId
,
4
);
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNeuEventList
=
eventClient
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
,
4
);
if
(
CollectionUtils
.
isEmpty
(
topNeuEventList
))
{
if
(
CollectionUtils
.
isEmpty
(
topNeuEventList
))
{
List
<
Map
.
Entry
<
String
,
Integer
>>
topNeuArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
List
<
Map
.
Entry
<
String
,
Integer
>>
topNeuArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
result
.
put
(
"topNeuSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNeuArticleList
));
result
.
put
(
"topNeuSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNeuArticleList
));
...
@@ -380,7 +389,9 @@ public class ReportServiceImpl implements ReportService {
...
@@ -380,7 +389,9 @@ public class ReportServiceImpl implements ReportService {
result
.
put
(
"curNegTotal"
,
curNegativeTotal
);
result
.
put
(
"curNegTotal"
,
curNegativeTotal
);
result
.
put
(
"curNegPro"
,
curTotal
==
0
?
0
:
curNegativeTotal
*
1.0
/
curTotal
);
result
.
put
(
"curNegPro"
,
curTotal
==
0
?
0
:
curNegativeTotal
*
1.0
/
curTotal
);
//中性事件传播量top
//中性事件传播量top
List
<
Event
>
topNegEventList
=
eventDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
contendId
,
4
);
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNegEventList
=
eventClient
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
,
4
);
if
(
CollectionUtils
.
isEmpty
(
topNegEventList
))
{
if
(
CollectionUtils
.
isEmpty
(
topNegEventList
))
{
List
<
Map
.
Entry
<
String
,
Integer
>>
topNegArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
List
<
Map
.
Entry
<
String
,
Integer
>>
topNegArticleList
=
markDataService
.
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
linkedGroupId
,
contendId
,
4
);
result
.
put
(
"topNegSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNegArticleList
));
result
.
put
(
"topNegSummary"
,
this
.
getTopArticlesMsg
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
contendId
,
topNegArticleList
));
...
@@ -457,17 +468,24 @@ public class ReportServiceImpl implements ReportService {
...
@@ -457,17 +468,24 @@ public class ReportServiceImpl implements ReportService {
return
emotions
.
stream
().
map
(
emotion
->
{
return
emotions
.
stream
().
map
(
emotion
->
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"name"
,
Objects
.
equals
(
emotion
,
EmotionEnum
.
POSITIVE
.
getName
())
?
"正面事件"
:
Objects
.
equals
(
emotion
,
EmotionEnum
.
NEGATIVE
.
getName
())
?
"负面事件"
:
"中性事件"
);
result
.
put
(
"name"
,
Objects
.
equals
(
emotion
,
EmotionEnum
.
POSITIVE
.
getName
())
?
"正面事件"
:
Objects
.
equals
(
emotion
,
EmotionEnum
.
NEGATIVE
.
getName
())
?
"负面事件"
:
"中性事件"
);
List
<
Event
>
topEventList
=
eventDao
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
,
10
);
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
=
eventClient
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
emotion
,
projectId
,
projectId
,
10
);
result
.
put
(
"events"
,
topEventList
.
stream
().
map
(
event
->
{
result
.
put
(
"events"
,
topEventList
.
stream
().
map
(
event
->
{
JSONObject
topEvent
=
new
JSONObject
();
JSONObject
topEvent
=
new
JSONObject
();
boolean
hasAnalyze
=
Objects
.
equals
(
event
.
getContendId
(),
Constant
.
PRIMARY_CONTEND_ID
);
boolean
hasAnalyze
=
false
;
for
(
BrandkbsBasicInfo
brandkbsInfo
:
event
.
getBrandkbsInfos
())
{
if
(
brandkbsInfo
.
getBrandkbsProjectId
().
equals
(
projectId
)
&&
brandkbsInfo
.
getBrandkbsBrandId
().
equals
(
projectId
)){
hasAnalyze
=
true
;
}
}
topEvent
.
put
(
"id"
,
event
.
getId
());
topEvent
.
put
(
"id"
,
event
.
getId
());
String
title
=
event
.
get
Titl
e
();
String
title
=
event
.
get
Nam
e
();
topEvent
.
put
(
"title"
,
title
.
length
()
<=
30
?
title
:
title
.
substring
(
0
,
30
)
+
"..."
);
topEvent
.
put
(
"title"
,
title
.
length
()
<=
30
?
title
:
title
.
substring
(
0
,
30
)
+
"..."
);
topEvent
.
put
(
"influence"
,
event
.
getInfluence
());
topEvent
.
put
(
"influence"
,
event
.
getInfluence
());
topEvent
.
put
(
"articleCount"
,
event
.
getTotalDisseminationVolume
());
topEvent
.
put
(
"articleCount"
,
event
.
getTotalDisseminationVolume
());
//
查询
首发稿件
//
首发稿件
EventData
firstData
=
eventDataDao
.
findFirstData
(
event
.
getId
(),
event
.
getCollectionName
()
);
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventData
firstData
=
event
.
getOriginArticle
(
);
topEvent
.
put
(
"firstSource"
,
Objects
.
isNull
(
firstData
)
?
""
:
firstData
.
getSource
());
topEvent
.
put
(
"firstSource"
,
Objects
.
isNull
(
firstData
)
?
""
:
firstData
.
getSource
());
topEvent
.
put
(
"hasAnalyze"
,
hasAnalyze
);
topEvent
.
put
(
"hasAnalyze"
,
hasAnalyze
);
return
topEvent
;
return
topEvent
;
...
@@ -516,12 +534,18 @@ public class ReportServiceImpl implements ReportService {
...
@@ -516,12 +534,18 @@ public class ReportServiceImpl implements ReportService {
* @param topEventList top事件集合
* @param topEventList top事件集合
* @return top事件信息
* @return top事件信息
*/
*/
private
List
<
JSONObject
>
getTopEventMsg
(
List
<
Event
>
topEventList
)
{
private
List
<
JSONObject
>
getTopEventMsg
(
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
return
topEventList
.
stream
().
map
(
event
->
{
return
topEventList
.
stream
().
map
(
event
->
{
boolean
hasAnalyze
=
Objects
.
equals
(
event
.
getContendId
(),
Constant
.
PRIMARY_CONTEND_ID
);
boolean
hasAnalyze
=
false
;
for
(
BrandkbsBasicInfo
brandkbsInfo
:
event
.
getBrandkbsInfos
())
{
if
(
brandkbsInfo
.
getBrandkbsProjectId
().
equals
(
projectId
)
&&
brandkbsInfo
.
getBrandkbsBrandId
().
equals
(
projectId
)){
hasAnalyze
=
true
;
}
}
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
event
.
getId
());
jsonObject
.
put
(
"id"
,
event
.
getId
());
String
title
=
event
.
get
Titl
e
();
String
title
=
event
.
get
Nam
e
();
jsonObject
.
put
(
"title"
,
title
.
length
()
<=
30
?
title
:
title
.
substring
(
0
,
30
)
+
"..."
);
jsonObject
.
put
(
"title"
,
title
.
length
()
<=
30
?
title
:
title
.
substring
(
0
,
30
)
+
"..."
);
jsonObject
.
put
(
"hasAnalyze"
,
hasAnalyze
);
jsonObject
.
put
(
"hasAnalyze"
,
hasAnalyze
);
return
jsonObject
;
return
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