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
2fb00468
Commit
2fb00468
authored
Feb 17, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
事件中间件接入代码结构调整,新增热门事件接口
parent
4f64fde4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
631 additions
and
104 deletions
+631
-104
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
+5
-8
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+1
-4
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+6
-0
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
+302
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
+207
-0
src/main/java/com/zhiwei/brandkbs2/pojo/external/BrandkbsHotEventWarn.java
+5
-1
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
+14
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+24
-24
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+30
-30
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
+14
-13
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
+9
-8
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
+6
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+8
-11
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
View file @
2fb00468
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO
;
...
@@ -14,11 +13,9 @@ import com.zhiwei.brandkbs2.pojo.Behavior;
...
@@ -14,11 +13,9 @@ import com.zhiwei.brandkbs2.pojo.Behavior;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -53,9 +50,6 @@ public class ProjectController extends BaseController {
...
@@ -53,9 +50,6 @@ public class ProjectController extends BaseController {
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Autowired
private
EventTagClient
eventTagClient
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
ProjectService
;
private
ProjectService
ProjectService
;
...
@@ -65,6 +59,9 @@ public class ProjectController extends BaseController {
...
@@ -65,6 +59,9 @@ public class ProjectController extends BaseController {
@Resource
(
name
=
"commonServiceImpl"
)
@Resource
(
name
=
"commonServiceImpl"
)
private
CommonService
commonService
;
private
CommonService
commonService
;
@Resource
(
name
=
"eventServiceImpl"
)
private
EventService
eventService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"项目管理"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"项目管理"
,
true
);
@Value
(
"${brandkbs.img.url}"
)
@Value
(
"${brandkbs.img.url}"
)
...
@@ -216,7 +213,7 @@ public class ProjectController extends BaseController {
...
@@ -216,7 +213,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"yuQingProjectId"
,
value
=
"舆情项目id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"yuQingProjectId"
,
value
=
"舆情项目id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@GetMapping
(
"/get/eventTags"
)
@GetMapping
(
"/get/eventTags"
)
public
ResponseResult
getEventTagsInfo
(
@RequestParam
(
value
=
"yuQingProjectId"
)
String
yuQingProjectId
){
public
ResponseResult
getEventTagsInfo
(
@RequestParam
(
value
=
"yuQingProjectId"
)
String
yuQingProjectId
){
Object
eventTags
=
event
TagClient
.
getEventTagGroupInfoBrandkbsWithoutEmotion
(
yuQingProjectId
).
getData
();
Object
eventTags
=
event
Service
.
getEventTagGroupInfoBrandkbsWithoutEmotion
(
yuQingProjectId
).
getData
();
return
ResponseResult
.
success
(
eventTags
);
return
ResponseResult
.
success
(
eventTags
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
2fb00468
...
@@ -49,9 +49,6 @@ public class AppEventController extends BaseController {
...
@@ -49,9 +49,6 @@ public class AppEventController extends BaseController {
@Value
(
"${ef.checkCaptcha.url}"
)
@Value
(
"${ef.checkCaptcha.url}"
)
private
String
efCheckCaptchaUrl
;
private
String
efCheckCaptchaUrl
;
@Autowired
private
EventMonitorClient
eventMonitorClient
;
private
final
EventService
eventService
;
private
final
EventService
eventService
;
public
AppEventController
(
EventService
eventService
)
{
public
AppEventController
(
EventService
eventService
)
{
...
@@ -186,7 +183,7 @@ public class AppEventController extends BaseController {
...
@@ -186,7 +183,7 @@ public class AppEventController extends BaseController {
@ApiOperation
(
"前台事件库-事件监测-新增事件监测"
)
@ApiOperation
(
"前台事件库-事件监测-新增事件监测"
)
@PostMapping
(
"/addEventMonitor"
)
@PostMapping
(
"/addEventMonitor"
)
public
ResponseResult
addEventMonitor
(
@RequestBody
EventDTO
dto
){
public
ResponseResult
addEventMonitor
(
@RequestBody
EventDTO
dto
){
if
(
event
MonitorClient
.
countMonitoringEventsBrandkbs
(
UserThreadLocal
.
getProjectId
()
)
>=
10
){
if
(
event
Service
.
getMonitoringEventsCount
(
)
>=
10
){
return
ResponseResult
.
failure
(
"监测事件数量不得超过10"
);
return
ResponseResult
.
failure
(
"监测事件数量不得超过10"
);
}
}
eventService
.
addEventMonitor
(
dto
);
eventService
.
addEventMonitor
(
dto
);
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
2fb00468
...
@@ -197,6 +197,12 @@ public class AppSearchController extends BaseController {
...
@@ -197,6 +197,12 @@ public class AppSearchController extends BaseController {
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
null
,
5
));
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
null
,
5
));
}
}
@ApiOperation
(
"搜索-热门事件"
)
@GetMapping
(
"/lastEventTop"
)
public
ResponseResult
getLastEventTopMiddleware
()
{
return
ResponseResult
.
success
(
eventService
.
getLastEventTopMiddleware
(
null
,
5
));
}
@ApiOperation
(
"搜索-前台事件库-搜索条件"
)
@ApiOperation
(
"搜索-前台事件库-搜索条件"
)
@GetMapping
(
"/event/list/criteria"
)
@GetMapping
(
"/event/list/criteria"
)
public
ResponseResult
getEventsSearchCriteria
()
{
public
ResponseResult
getEventsSearchCriteria
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
0 → 100644
View file @
2fb00468
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.ReturnData
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO
;
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
com.zhiwei.middleware.event.pojo.entity.EventDisseminationTrend
;
import
com.zhiwei.middleware.event.pojo.vo.EventListInfoVO
;
import
com.zhiwei.middleware.event.pojo.vo.EventVO
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: EventMiddlewareDao
* @Description 事件中间件
* @author: cjz
* @date: 2023-02-08 10:45
*/
public
interface
EventMiddlewareDao
{
/**
* 按筛选条件获取事件列表
* @param dto
* @return
*/
PageData
<
EventListInfoVO
>
getEventListBrandkbs
(
BrandkbsEventSearchDTO
dto
);
/**
* 根据id删除事件
* @param eventId
* @return
*/
ReturnData
deleteEvent
(
String
eventId
);
/**
* 获取事件基础信息
* @param eventId
* @return
*/
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
);
/**
* 获取传播趋势
* @param eventId
* @param type
* @return
*/
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
);
/**
* 持续事件
* @param eventId
* @param submitter
* @param submitterId
* @return
*/
ReturnData
continueEvent
(
String
eventId
,
String
submitter
,
String
submitterId
);
/**
* 获取事件热门文章分析
* @param eventId
* @param type
* @param emotion
* @param aggTitle
* @return
*/
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
);
/**
* 获取事件渠道发声
* @param eventId
* @param type
* @param page
* @param pageSize
* @param sorter
* @return
*/
PageData
<
JSONObject
>
eventChannelVoices
(
String
eventId
,
String
type
,
int
page
,
int
pageSize
,
String
sorter
);
/**
* 统计事件数量
* @param eventIds
* @return
*/
Long
countInEventIds
(
List
<
String
>
eventIds
);
/**
* 统计事件数据数量
* @param event
* @return
*/
Long
countEventDataByEventId
(
Event
event
);
/**
* 统计事件数据数量
* @param event
* @return
*/
Long
countEventDataByEventIdAndFid
(
Event
event
,
String
fid
);
/**
* 获取事件列表
* @param eventIds
* @return
*/
List
<
Event
>
findListInEventIds
(
List
<
String
>
eventIds
,
int
page
,
int
pageSize
);
/**
* 获取事件列表
* @param eventIds
* @return
*/
List
<
Event
>
findListInEventIds
(
List
<
String
>
eventIds
);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
List
<
String
>
getEvents
(
String
fid
);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
Map
<
Long
,
List
<
Event
>>
getEventDay
(
String
fid
,
Long
startTime
,
Long
endTime
);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
Map
<
Long
,
List
<
Event
>>
getEventMonth
(
String
fid
,
Long
startTime
,
Long
endTime
);
/**
* 获取参与的反常事件数
*
* @param fid 渠道标识
* @param eventEmotions 事件情感倾向
* @param articleEmotion 文章情感倾向
* @return 参与的反常事件数
*/
Long
getEventCount
(
String
fid
,
List
<
String
>
eventEmotions
,
String
articleEmotion
);
/**
* 根据特征值获取事件数
*
* @param startTime
* @param endTime
* @param emotion
* @param projectId
* @param contendId
* @return
*/
Long
getEventCountByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
);
/**
* 根据特征值获取事件
*
* @param startTime
* @param endTime
* @param emotion
* @param projectId
* @param contendId
* @return
*/
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
);
/**
* 根据特征值获取事件
*
* @param startTime
* @param endTime
* @param emotions
* @param projectId
* @param contendId
* @return
*/
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
List
<
String
>
emotions
,
String
projectId
,
String
contendId
,
int
limit
);
List
<
Event
>
getEventsByTotalChannelVolumeTop
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
);
/**
* 获得最新的事件
*
* @return
*/
List
<
JSONObject
>
getLastEventTop
(
String
keyword
,
int
limit
,
String
brandkbsProjectId
);
/**
* 获取传播量
*
* @param event 事件
* @return 传播量
*/
Long
getEventArticleCount
(
Event
event
);
/**
* 获取渠道参与传播量
*
* @param event 事件
* @return 传播量
*/
Long
getEventArticleWithChannelCount
(
Event
event
,
String
source
,
String
realSource
,
String
platform
);
/**
* 获取事件监测列表
* @param brandkbsBrandId
* @param page
* @param pageSize
* @return
*/
PageData
<
EventVO
>
getEventMonitorBrandkbs
(
String
brandkbsBrandId
,
int
page
,
int
pageSize
);
/**
* 新增事件监测
* @param eventDTO
* @return
*/
ReturnData
addEventMonitor
(
EventDTO
eventDTO
);
/**
* 编辑单个监测事件
* @param eventId
* @param eventDTO
* @param brandkbsInfos
* @return
*/
ReturnData
modifyEventMonitor
(
String
eventId
,
EventDTO
eventDTO
,
List
<
BrandkbsBasicInfo
>
brandkbsInfos
);
/**
* 结束事件监测
* @param eventId
* @param submitter
* @param submitterId
* @return
*/
ReturnData
endEventMonitor
(
String
eventId
,
String
submitter
,
String
submitterId
);
/**
* 统计状态为监测中的事件数量
* @param brandId
* @return
*/
Long
countMonitoringEventsBrandkbs
(
String
brandId
);
/**
* 获取标签组信息
* @param projectId
* @return
*/
ReturnData
getEventTagGroupInfoBrandkbs
(
String
projectId
);
/**
*
* @param yuQingProject
* @param yuQingProjectId
* @param eventTags
* @param brandkbsProject
* @param brandkbsProjectId
* @param brandkbsBrand
* @param brandkbsBrandId
* @param submitter
* @param submitterId
* @return
*/
ReturnData
bindBrandkbs
(
String
yuQingProject
,
String
yuQingProjectId
,
List
<
EventTagRelatedDTO
>
eventTags
,
String
brandkbsProject
,
String
brandkbsProjectId
,
String
brandkbsBrand
,
String
brandkbsBrandId
,
String
submitter
,
String
submitterId
);
/**
* 获取品见项目标签绑定情况
* @param brandkbsProjectId
* @return
*/
ReturnData
getBrandkbsBindingEventTags
(
String
brandkbsProjectId
);
/**
* 修改品见关联关系,若存在则修改,否则新增
* @param yuQingProject
* @param yuQingProjectId
* @param eventTags
* @param brandkbsProject
* @param brandkbsProjectId
* @param brandkbsBrand
* @param brandkbsBrandId
* @param submitter
* @param submitterId
* @return
*/
ReturnData
modifyBrandkbsEventTags
(
String
yuQingProject
,
String
yuQingProjectId
,
List
<
EventTagRelatedDTO
>
eventTags
,
String
brandkbsProject
,
String
brandkbsProjectId
,
String
brandkbsBrand
,
String
brandkbsBrandId
,
String
submitter
,
String
submitterId
);
/**
* 获取标签组信息
* @param projectId
* @return
*/
ReturnData
getEventTagGroupInfoBrandkbsWithoutEmotion
(
String
projectId
);
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
0 → 100644
View file @
2fb00468
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.EventMiddlewareDao
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.core.EventMonitorClient
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.ReturnData
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventDisseminationTrend
;
import
com.zhiwei.middleware.event.pojo.vo.EventListInfoVO
;
import
com.zhiwei.middleware.event.pojo.vo.EventVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: EventMiddlewareDaoImpl
* @Description 事件中间件业务实现类
* @author: cjz
* @date: 2023-02-08 10:45
*/
@Component
(
"eventMiddlewareDao"
)
public
class
EventMiddlewareDaoImpl
implements
EventMiddlewareDao
{
@Autowired
private
EventClient
eventClient
;
@Autowired
private
EventTagClient
eventTagClient
;
@Autowired
private
EventMonitorClient
eventMonitorClient
;
@Override
public
PageData
<
EventListInfoVO
>
getEventListBrandkbs
(
BrandkbsEventSearchDTO
dto
)
{
return
eventClient
.
getEventListBrandkbs
(
dto
);
}
@Override
public
ReturnData
deleteEvent
(
String
eventId
)
{
return
eventClient
.
deleteEvent
(
eventId
);
}
@Override
public
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
)
{
return
eventClient
.
eventBaseInfo
(
eventId
);
}
@Override
public
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
)
{
return
eventClient
.
eventDisseminationTrends
(
eventId
,
type
);
}
@Override
public
ReturnData
continueEvent
(
String
eventId
,
String
submitter
,
String
submitterId
)
{
return
eventClient
.
continueEvent
(
eventId
,
submitter
,
submitterId
);
}
@Override
public
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
)
{
return
eventClient
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
);
}
@Override
public
PageData
<
JSONObject
>
eventChannelVoices
(
String
eventId
,
String
type
,
int
page
,
int
pageSize
,
String
sorter
)
{
return
eventClient
.
eventChannelVoices
(
eventId
,
type
,
page
,
pageSize
,
sorter
);
}
@Override
public
Long
countInEventIds
(
List
<
String
>
eventIds
)
{
return
eventClient
.
countInEventIds
(
eventIds
);
}
@Override
public
Long
countEventDataByEventId
(
Event
event
)
{
return
eventClient
.
countEventDataByEventId
(
event
);
}
@Override
public
Long
countEventDataByEventIdAndFid
(
Event
event
,
String
fid
)
{
return
eventClient
.
countEventDataByEventIdAndFid
(
event
,
fid
);
}
@Override
public
List
<
Event
>
findListInEventIds
(
List
<
String
>
eventIds
,
int
page
,
int
pageSize
)
{
return
eventClient
.
findListInEventIds
(
eventIds
,
page
,
pageSize
);
}
@Override
public
List
<
Event
>
findListInEventIds
(
List
<
String
>
eventIds
)
{
return
eventClient
.
findListInEventIds
(
eventIds
);
}
@Override
public
List
<
String
>
getEvents
(
String
fid
)
{
return
eventClient
.
getEvents
(
fid
);
}
@Override
public
Map
<
Long
,
List
<
Event
>>
getEventDay
(
String
fid
,
Long
startTime
,
Long
endTime
)
{
return
eventClient
.
getEventDay
(
fid
,
startTime
,
endTime
);
}
@Override
public
Map
<
Long
,
List
<
Event
>>
getEventMonth
(
String
fid
,
Long
startTime
,
Long
endTime
)
{
return
eventClient
.
getEventMonth
(
fid
,
startTime
,
endTime
);
}
@Override
public
Long
getEventCount
(
String
fid
,
List
<
String
>
eventEmotions
,
String
articleEmotion
)
{
return
eventClient
.
getEventCount
(
fid
,
eventEmotions
,
articleEmotion
);
}
@Override
public
Long
getEventCountByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
{
return
eventClient
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
);
}
@Override
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
return
eventClient
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
,
limit
);
}
@Override
public
List
<
Event
>
getEventsByProjectIdAndContendId
(
Long
startTime
,
Long
endTime
,
List
<
String
>
emotions
,
String
projectId
,
String
contendId
,
int
limit
)
{
return
eventClient
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
emotions
,
projectId
,
contendId
,
limit
);
}
@Override
public
List
<
Event
>
getEventsByTotalChannelVolumeTop
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
int
limit
)
{
return
eventClient
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
emotion
,
projectId
,
contendId
,
limit
);
}
@Override
public
List
<
JSONObject
>
getLastEventTop
(
String
keyword
,
int
limit
,
String
brandkbsProjectId
)
{
return
eventClient
.
getLastEventTop
(
keyword
,
limit
,
brandkbsProjectId
);
}
@Override
public
Long
getEventArticleCount
(
Event
event
)
{
return
eventClient
.
getEventArticleCount
(
event
);
}
@Override
public
Long
getEventArticleWithChannelCount
(
Event
event
,
String
source
,
String
realSource
,
String
platform
)
{
return
eventClient
.
getEventArticleWithChannelCount
(
event
,
source
,
realSource
,
platform
);
}
@Override
public
PageData
<
EventVO
>
getEventMonitorBrandkbs
(
String
brandkbsBrandId
,
int
page
,
int
pageSize
)
{
return
eventMonitorClient
.
getEventMonitorBrandkbs
(
brandkbsBrandId
,
page
,
pageSize
);
}
@Override
public
ReturnData
addEventMonitor
(
EventDTO
eventDTO
)
{
return
eventMonitorClient
.
addEventMonitor
(
eventDTO
);
}
@Override
public
ReturnData
modifyEventMonitor
(
String
eventId
,
EventDTO
eventDTO
,
List
<
BrandkbsBasicInfo
>
brandkbsInfos
)
{
return
eventMonitorClient
.
modifyEventMonitor
(
eventId
,
eventDTO
,
brandkbsInfos
);
}
@Override
public
ReturnData
endEventMonitor
(
String
eventId
,
String
submitter
,
String
submitterId
)
{
return
eventMonitorClient
.
endEventMonitor
(
eventId
,
submitter
,
submitterId
);
}
@Override
public
Long
countMonitoringEventsBrandkbs
(
String
brandId
)
{
return
eventMonitorClient
.
countMonitoringEventsBrandkbs
(
brandId
);
}
@Override
public
ReturnData
getEventTagGroupInfoBrandkbs
(
String
projectId
)
{
return
eventTagClient
.
getEventTagGroupInfoBrandkbs
(
projectId
);
}
@Override
public
ReturnData
bindBrandkbs
(
String
yuQingProject
,
String
yuQingProjectId
,
List
<
EventTagRelatedDTO
>
eventTags
,
String
brandkbsProject
,
String
brandkbsProjectId
,
String
brandkbsBrand
,
String
brandkbsBrandId
,
String
submitter
,
String
submitterId
)
{
return
eventTagClient
.
bindBrandkbs
(
yuQingProject
,
yuQingProjectId
,
eventTags
,
brandkbsProject
,
brandkbsProjectId
,
brandkbsBrand
,
brandkbsBrandId
,
submitter
,
submitterId
);
}
@Override
public
ReturnData
getBrandkbsBindingEventTags
(
String
brandkbsProjectId
)
{
return
eventTagClient
.
getBrandkbsBindingEventTags
(
brandkbsProjectId
);
}
@Override
public
ReturnData
modifyBrandkbsEventTags
(
String
yuQingProject
,
String
yuQingProjectId
,
List
<
EventTagRelatedDTO
>
eventTags
,
String
brandkbsProject
,
String
brandkbsProjectId
,
String
brandkbsBrand
,
String
brandkbsBrandId
,
String
submitter
,
String
submitterId
)
{
return
eventTagClient
.
modifyBrandkbsEventTags
(
yuQingProject
,
yuQingProjectId
,
eventTags
,
brandkbsProject
,
brandkbsProjectId
,
brandkbsBrand
,
brandkbsBrandId
,
submitter
,
submitterId
);
}
@Override
public
ReturnData
getEventTagGroupInfoBrandkbsWithoutEmotion
(
String
projectId
)
{
return
eventTagClient
.
getEventTagGroupInfoBrandkbsWithoutEmotion
(
projectId
);
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/external/BrandkbsHotEventWarn.java
View file @
2fb00468
...
@@ -4,6 +4,7 @@ import com.zhiwei.middleware.event.pojo.entity.Event;
...
@@ -4,6 +4,7 @@ import com.zhiwei.middleware.event.pojo.entity.Event;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -74,8 +75,11 @@ public class BrandkbsHotEventWarn {
...
@@ -74,8 +75,11 @@ public class BrandkbsHotEventWarn {
hotEvent
.
setInfluence
(
event
.
getInfluence
());
hotEvent
.
setInfluence
(
event
.
getInfluence
());
// List<String> tagList = event.getEventTag().entrySet().stream().filter(entry -> !"情感倾向".equals(entry.getKey()))
// List<String> tagList = 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
()))
List
<
String
>
tagList
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
event
.
getEventTags
()))
{
tagList
=
event
.
getEventTags
().
stream
().
filter
(
eventTagBasicInfo
->
!
"情感倾向"
.
equals
(
eventTagBasicInfo
.
getGroupName
()))
.
map
(
EventTagBasicInfo:
:
getName
).
collect
(
Collectors
.
toList
());
.
map
(
EventTagBasicInfo:
:
getName
).
collect
(
Collectors
.
toList
());
}
hotEvent
.
setTagList
(
tagList
);
hotEvent
.
setTagList
(
tagList
);
return
hotEvent
;
return
hotEvent
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
View file @
2fb00468
...
@@ -14,6 +14,7 @@ import com.zhiwei.brandkbs2.pojo.vo.EventVO;
...
@@ -14,6 +14,7 @@ import com.zhiwei.brandkbs2.pojo.vo.EventVO;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.ReturnData
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
...
@@ -290,6 +291,19 @@ public interface EventService {
...
@@ -290,6 +291,19 @@ public interface EventService {
List
<
JSONObject
>
getLastEventTop
(
String
keyword
,
int
limit
);
List
<
JSONObject
>
getLastEventTop
(
String
keyword
,
int
limit
);
/**
/**
* 事件中间件获得最新的事件
*
* @return
*/
List
<
JSONObject
>
getLastEventTopMiddleware
(
String
keyword
,
int
limit
);
/**
* 事件中间件获取标签组信息
* @return
*/
ReturnData
getEventTagGroupInfoBrandkbsWithoutEmotion
(
String
yuqingProjectId
);
/**
* 获取未结束的事件
* 获取未结束的事件
* @param projectId
* @param projectId
* @return
* @return
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
2fb00468
This diff is collapsed.
Click to expand it.
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
2fb00468
...
@@ -7,10 +7,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
...
@@ -7,10 +7,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.*
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDisseminationTrendDao
;
import
com.zhiwei.brandkbs2.dao.EventTopArticlesAnalysisDao
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
...
@@ -39,10 +36,8 @@ import com.zhiwei.brandkbs2.util.MongoUtil;
...
@@ -39,10 +36,8 @@ 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.auth.util.JwtUtil
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.core.EventMonitorClient
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.PageData
;
import
com.zhiwei.middleware.event.pojo.ReturnData
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
...
@@ -101,6 +96,9 @@ public class EventServiceImpl implements EventService {
...
@@ -101,6 +96,9 @@ public class EventServiceImpl implements EventService {
@Resource
(
name
=
"eventDao"
)
@Resource
(
name
=
"eventDao"
)
private
EventDao
eventDao
;
private
EventDao
eventDao
;
@Resource
(
name
=
"eventMiddlewareDao"
)
private
EventMiddlewareDao
eventMiddlewareDao
;
@Resource
(
name
=
"eventDataDao"
)
@Resource
(
name
=
"eventDataDao"
)
private
EventDataDao
eventDataDao
;
private
EventDataDao
eventDataDao
;
...
@@ -131,15 +129,6 @@ public class EventServiceImpl implements EventService {
...
@@ -131,15 +129,6 @@ public class EventServiceImpl implements EventService {
@Autowired
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
private
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
EventMonitorClient
eventMonitorClient
;
@Autowired
private
EventClient
eventClient
;
@Autowired
private
EventTagClient
eventTagClient
;
@Resource
@Resource
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
...
@@ -711,6 +700,17 @@ public class EventServiceImpl implements EventService {
...
@@ -711,6 +700,17 @@ public class EventServiceImpl implements EventService {
}
}
@Override
@Override
public
List
<
JSONObject
>
getLastEventTopMiddleware
(
String
keyword
,
int
limit
)
{
return
eventMiddlewareDao
.
getLastEventTop
(
keyword
,
limit
,
UserThreadLocal
.
getProjectId
());
}
@Override
public
ReturnData
getEventTagGroupInfoBrandkbsWithoutEmotion
(
String
yuqingProjectId
)
{
return
eventMiddlewareDao
.
getEventTagGroupInfoBrandkbsWithoutEmotion
(
yuqingProjectId
);
}
@Override
public
List
<
Event
>
findNotEndEventByProjectId
(
String
projectId
)
{
public
List
<
Event
>
findNotEndEventByProjectId
(
String
projectId
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"endStatus"
).
is
(
false
));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"endStatus"
).
is
(
false
));
return
eventDao
.
findList
(
query
);
return
eventDao
.
findList
(
query
);
...
@@ -751,7 +751,7 @@ public class EventServiceImpl implements EventService {
...
@@ -751,7 +751,7 @@ public class EventServiceImpl implements EventService {
result
.
put
(
"brands"
,
projectService
.
getBrands
(
projectId
,
true
));
result
.
put
(
"brands"
,
projectService
.
getBrands
(
projectId
,
true
));
// 事件调性
// 事件调性
AbstractProject
abstractProject
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
brandId
);
AbstractProject
abstractProject
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
brandId
);
List
<
EventTagBrandkbsVO
>
eventTags
=
(
List
<
EventTagBrandkbsVO
>)
event
TagClient
.
getEventTagGroupInfoBrandkbs
(
abstractProject
.
getBrandLinkedGroupId
()).
getData
();
List
<
EventTagBrandkbsVO
>
eventTags
=
(
List
<
EventTagBrandkbsVO
>)
event
MiddlewareDao
.
getEventTagGroupInfoBrandkbs
(
abstractProject
.
getBrandLinkedGroupId
()).
getData
();
List
<
EventTagBrandkbsVO
>
emotion
=
eventTags
.
stream
().
filter
(
eventTag
->
EventTagEnum
.
EVENT_ATTRIBUTE
.
getName
().
equals
(
eventTag
.
getGroupName
())).
collect
(
Collectors
.
toList
());
List
<
EventTagBrandkbsVO
>
emotion
=
eventTags
.
stream
().
filter
(
eventTag
->
EventTagEnum
.
EVENT_ATTRIBUTE
.
getName
().
equals
(
eventTag
.
getGroupName
())).
collect
(
Collectors
.
toList
());
result
.
put
(
"emotions"
,
emotion
);
result
.
put
(
"emotions"
,
emotion
);
// 时间
// 时间
...
@@ -766,18 +766,18 @@ public class EventServiceImpl implements EventService {
...
@@ -766,18 +766,18 @@ public class EventServiceImpl implements EventService {
if
(
Constant
.
PRIMARY_CONTEND_ID
.
equals
(
dto
.
getBrandId
())){
if
(
Constant
.
PRIMARY_CONTEND_ID
.
equals
(
dto
.
getBrandId
())){
dto
.
setBrandId
(
UserThreadLocal
.
getProjectId
());
dto
.
setBrandId
(
UserThreadLocal
.
getProjectId
());
}
}
return
event
Client
.
getEventListBrandkbs
(
dto
);
return
event
MiddlewareDao
.
getEventListBrandkbs
(
dto
);
}
}
@Override
@Override
public
List
<
EventTagBrandkbsVO
>
getEventTagsCriteria
()
{
public
List
<
EventTagBrandkbsVO
>
getEventTagsCriteria
()
{
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
return
(
List
<
EventTagBrandkbsVO
>)
event
TagClient
.
getEventTagGroupInfoBrandkbs
(
project
.
getBrandLinkedGroupId
()).
getData
();
return
(
List
<
EventTagBrandkbsVO
>)
event
MiddlewareDao
.
getEventTagGroupInfoBrandkbs
(
project
.
getBrandLinkedGroupId
()).
getData
();
}
}
@Override
@Override
public
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventVO
>
getEventMonitor
(
int
page
,
int
pageSize
)
{
public
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventVO
>
getEventMonitor
(
int
page
,
int
pageSize
)
{
return
eventM
onitorClient
.
getEventMonitorBrandkbs
(
UserThreadLocal
.
getProjectId
(),
page
,
pageSize
);
return
eventM
iddlewareDao
.
getEventMonitorBrandkbs
(
UserThreadLocal
.
getProjectId
(),
page
,
pageSize
);
}
}
@Override
@Override
...
@@ -805,7 +805,7 @@ public class EventServiceImpl implements EventService {
...
@@ -805,7 +805,7 @@ public class EventServiceImpl implements EventService {
brandkbsBasicInfo
.
setBrandkbsBrandId
(
project
.
getId
());
brandkbsBasicInfo
.
setBrandkbsBrandId
(
project
.
getId
());
brandkbsBasicInfos
.
add
(
brandkbsBasicInfo
);
brandkbsBasicInfos
.
add
(
brandkbsBasicInfo
);
dto
.
setBrandkbsInfos
(
brandkbsBasicInfos
);
dto
.
setBrandkbsInfos
(
brandkbsBasicInfos
);
eventM
onitorClient
.
addEventMonitor
(
dto
);
eventM
iddlewareDao
.
addEventMonitor
(
dto
);
}
}
@Override
@Override
...
@@ -819,7 +819,7 @@ public class EventServiceImpl implements EventService {
...
@@ -819,7 +819,7 @@ public class EventServiceImpl implements EventService {
dto
.
setProjectId
(
project
.
getBrandLinkedGroupId
());
dto
.
setProjectId
(
project
.
getBrandLinkedGroupId
());
dto
.
setSubmitter
(
submitter
);
dto
.
setSubmitter
(
submitter
);
dto
.
setSubmitterId
(
submitterId
);
dto
.
setSubmitterId
(
submitterId
);
eventM
onitorClient
.
modifyEventMonitor
(
dto
.
getId
(),
dto
,
null
);
eventM
iddlewareDao
.
modifyEventMonitor
(
dto
.
getId
(),
dto
,
null
);
}
}
@Override
@Override
...
@@ -829,37 +829,37 @@ public class EventServiceImpl implements EventService {
...
@@ -829,37 +829,37 @@ public class EventServiceImpl implements EventService {
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
eventM
onitorClient
.
endEventMonitor
(
eventId
,
submitter
,
submitterId
);
eventM
iddlewareDao
.
endEventMonitor
(
eventId
,
submitter
,
submitterId
);
}
}
@Override
@Override
public
void
deleteEventMonitor
(
String
eventId
)
{
public
void
deleteEventMonitor
(
String
eventId
)
{
event
Client
.
deleteEvent
(
eventId
);
event
MiddlewareDao
.
deleteEvent
(
eventId
);
}
}
@Override
@Override
public
Long
getMonitoringEventsCount
()
{
public
Long
getMonitoringEventsCount
()
{
return
eventM
onitorClient
.
countMonitoringEventsBrandkbs
(
UserThreadLocal
.
getProjectId
());
return
eventM
iddlewareDao
.
countMonitoringEventsBrandkbs
(
UserThreadLocal
.
getProjectId
());
}
}
@Override
@Override
public
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
)
{
public
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
)
{
return
event
Client
.
eventBaseInfo
(
eventId
);
return
event
MiddlewareDao
.
eventBaseInfo
(
eventId
);
}
}
@Override
@Override
public
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
)
{
public
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
)
{
return
event
Client
.
eventDisseminationTrends
(
eventId
,
type
);
return
event
MiddlewareDao
.
eventDisseminationTrends
(
eventId
,
type
);
}
}
@Override
@Override
public
PageData
<
JSONObject
>
eventChannelVoices
(
String
eventId
,
String
type
,
int
page
,
int
pageSize
,
String
sorter
)
{
public
PageData
<
JSONObject
>
eventChannelVoices
(
String
eventId
,
String
type
,
int
page
,
int
pageSize
,
String
sorter
)
{
return
event
Client
.
eventChannelVoices
(
eventId
,
type
,
page
,
pageSize
,
sorter
);
return
event
MiddlewareDao
.
eventChannelVoices
(
eventId
,
type
,
page
,
pageSize
,
sorter
);
}
}
@Override
@Override
public
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
)
{
public
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
)
{
return
event
Client
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
);
return
event
MiddlewareDao
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
);
}
}
@Override
@Override
...
@@ -869,7 +869,7 @@ public class EventServiceImpl implements EventService {
...
@@ -869,7 +869,7 @@ public class EventServiceImpl implements EventService {
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
event
Client
.
continueEvent
(
eventId
,
submitter
,
submitterId
);
event
MiddlewareDao
.
continueEvent
(
eventId
,
submitter
,
submitterId
);
}
}
@Data
@Data
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
View file @
2fb00468
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.GlobalPojo;
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.GlobalPojo;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventMiddlewareDao
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
...
@@ -60,12 +61,12 @@ public class IndexServiceImpl implements IndexService {
...
@@ -60,12 +61,12 @@ public class IndexServiceImpl implements IndexService {
@Resource
@Resource
private
EventDataDao
eventDataDao
;
private
EventDataDao
eventDataDao
;
@Resource
(
name
=
"eventMiddlewareDao"
)
EventMiddlewareDao
eventMiddlewareDao
;
@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
)
{
...
@@ -190,9 +191,9 @@ public class IndexServiceImpl implements IndexService {
...
@@ -190,9 +191,9 @@ public class IndexServiceImpl implements IndexService {
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
;
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
long
total
=
event
Client
.
getEventCountByProjectIdAndContendId
(
null
,
null
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
total
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
null
,
null
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
eventTotal
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
eventTotal
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
oldEventTotal
=
event
Client
.
getEventCountByProjectIdAndContendId
(
oldStartTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
oldEventTotal
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
oldStartTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
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
);
...
@@ -424,10 +425,10 @@ public class IndexServiceImpl implements IndexService {
...
@@ -424,10 +425,10 @@ public class IndexServiceImpl implements IndexService {
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
contendId
=
Objects
.
equals
(
contendId
,
Constant
.
PRIMARY_CONTEND_ID
)
?
projectId
:
contendId
;
contendId
=
Objects
.
equals
(
contendId
,
Constant
.
PRIMARY_CONTEND_ID
)
?
projectId
:
contendId
;
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
eventList
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
eventList
=
event
Client
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
,
1
);
event
MiddlewareDao
.
getEventsByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
eventList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
eventList
))
{
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
event
=
eventList
.
get
(
0
);
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
event
=
eventList
.
get
(
0
);
long
articleCount
=
event
Client
.
getEventArticleCount
(
event
);
long
articleCount
=
event
MiddlewareDao
.
getEventArticleCount
(
event
);
result
.
put
(
"id"
,
event
.
getId
());
result
.
put
(
"id"
,
event
.
getId
());
result
.
put
(
"title"
,
event
.
getName
());
result
.
put
(
"title"
,
event
.
getName
());
result
.
put
(
"influence"
,
event
.
getInfluence
());
result
.
put
(
"influence"
,
event
.
getInfluence
());
...
@@ -542,7 +543,7 @@ public class IndexServiceImpl implements IndexService {
...
@@ -542,7 +543,7 @@ public class IndexServiceImpl implements IndexService {
result
.
put
(
"time"
,
startTime
);
result
.
put
(
"time"
,
startTime
);
//统计时间段总事件数
//统计时间段总事件数
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
long
eventCount
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
eventCount
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
result
.
put
(
"eventCount"
,
eventCount
);
result
.
put
(
"eventCount"
,
eventCount
);
lineList
.
add
(
result
);
lineList
.
add
(
result
);
}
}
...
@@ -564,10 +565,10 @@ public class IndexServiceImpl implements IndexService {
...
@@ -564,10 +565,10 @@ public class IndexServiceImpl implements IndexService {
Long
endTime
=
map
.
get
(
"endTime"
);
Long
endTime
=
map
.
get
(
"endTime"
);
//统计时间段总事件数
//统计时间段总事件数
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
long
totalEventCount
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
totalEventCount
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
projectId
);
long
posEventCount
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
);
long
posEventCount
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
);
long
neuEventCount
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
);
long
neuEventCount
=
event
MiddlewareDao
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
);
long
negEventCount
=
event
Client
.
getEventCountByProjectIdAndContendId
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
);
long
negEventCount
=
event
MiddlewareDao
.
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/ProjectServiceImpl.java
View file @
2fb00468
...
@@ -5,6 +5,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
...
@@ -5,6 +5,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.EventMiddlewareDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
...
@@ -79,12 +80,12 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -79,12 +80,12 @@ public class ProjectServiceImpl implements ProjectService {
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
private
UserService
userService
;
@Resource
(
name
=
"eventMiddlewareDao"
)
private
EventMiddlewareDao
eventMiddlewareDao
;
@Value
(
"${jwt.key}"
)
@Value
(
"${jwt.key}"
)
private
String
jwtKey
;
private
String
jwtKey
;
@Autowired
private
EventTagClient
eventTagClient
;
@Value
(
"${brandkbs.file.url}"
)
@Value
(
"${brandkbs.file.url}"
)
private
String
brandkbsFileUrl
;
private
String
brandkbsFileUrl
;
...
@@ -116,14 +117,14 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -116,14 +117,14 @@ public class ProjectServiceImpl implements ProjectService {
// 主品牌绑定事件标签,主品牌品牌id使用项目id
// 主品牌绑定事件标签,主品牌品牌id使用项目id
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
event
TagClient
.
bindBrandkbs
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
event
MiddlewareDao
.
bindBrandkbs
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
project
.
getId
(),
submitter
,
submitterId
);
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
project
.
getId
(),
submitter
,
submitterId
);
// 竞品绑定事件标签
// 竞品绑定事件标签
List
<
Contend
>
contendList
=
project
.
getContendList
();
List
<
Contend
>
contendList
=
project
.
getContendList
();
if
(
CollectionUtils
.
isNotEmpty
(
contendList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
contendList
))
{
for
(
Contend
contend
:
contendList
)
{
for
(
Contend
contend
:
contendList
)
{
List
<
EventTagRelatedDTO
>
contendEventTagsList
=
contend
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
contendEventTagsList
=
contend
.
getEventTagsList
();
event
TagClient
.
bindBrandkbs
(
contend
.
getBrandLinkedGroup
(),
contend
.
getBrandLinkedGroupId
(),
contendEventTagsList
,
project
.
getProjectName
(),
event
MiddlewareDao
.
bindBrandkbs
(
contend
.
getBrandLinkedGroup
(),
contend
.
getBrandLinkedGroupId
(),
contendEventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
contend
.
getBrandName
(),
contend
.
getId
(),
submitter
,
submitterId
);
project
.
getId
(),
contend
.
getBrandName
(),
contend
.
getId
(),
submitter
,
submitterId
);
}
}
}
}
...
@@ -165,7 +166,7 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -165,7 +166,7 @@ public class ProjectServiceImpl implements ProjectService {
@Override
@Override
public
ProjectVO
getProjectVOWithEventTagsById
(
String
pid
)
{
public
ProjectVO
getProjectVOWithEventTagsById
(
String
pid
)
{
ProjectVO
projectVO
=
getProjectVOById
(
pid
);
ProjectVO
projectVO
=
getProjectVOById
(
pid
);
Map
<
String
,
List
<
EventTagRelatedDTO
>>
eventTagsMap
=
(
Map
<
String
,
List
<
EventTagRelatedDTO
>>)
event
TagClient
.
getBrandkbsBindingEventTags
(
pid
).
getData
();
Map
<
String
,
List
<
EventTagRelatedDTO
>>
eventTagsMap
=
(
Map
<
String
,
List
<
EventTagRelatedDTO
>>)
event
MiddlewareDao
.
getBrandkbsBindingEventTags
(
pid
).
getData
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
new
ArrayList
<>();
List
<
EventTagRelatedDTO
>
eventTagsList
=
new
ArrayList
<>();
if
(!
Tools
.
isEmpty
(
eventTagsMap
))
{
if
(!
Tools
.
isEmpty
(
eventTagsMap
))
{
// 获取主品牌标签
// 获取主品牌标签
...
@@ -210,14 +211,14 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -210,14 +211,14 @@ public class ProjectServiceImpl implements ProjectService {
// 主品牌修改绑定事件标签, 主品牌id使用项目id
// 主品牌修改绑定事件标签, 主品牌id使用项目id
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
event
TagClient
.
modifyBrandkbsEventTags
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
event
MiddlewareDao
.
modifyBrandkbsEventTags
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
project
.
getId
(),
submitter
,
submitterId
);
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
project
.
getId
(),
submitter
,
submitterId
);
// 竞品修改绑定事件标签
// 竞品修改绑定事件标签
List
<
Contend
>
contendList
=
project
.
getContendList
();
List
<
Contend
>
contendList
=
project
.
getContendList
();
if
(
CollectionUtils
.
isNotEmpty
(
contendList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
contendList
))
{
for
(
Contend
contend
:
contendList
)
{
for
(
Contend
contend
:
contendList
)
{
List
<
EventTagRelatedDTO
>
contendEventTagsList
=
contend
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
contendEventTagsList
=
contend
.
getEventTagsList
();
event
TagClient
.
modifyBrandkbsEventTags
(
contend
.
getBrandLinkedGroup
(),
contend
.
getBrandLinkedGroupId
(),
contendEventTagsList
,
project
.
getProjectName
(),
event
MiddlewareDao
.
modifyBrandkbsEventTags
(
contend
.
getBrandLinkedGroup
(),
contend
.
getBrandLinkedGroupId
(),
contendEventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
contend
.
getBrandName
(),
contend
.
getId
(),
submitter
,
submitterId
);
project
.
getId
(),
contend
.
getBrandName
(),
contend
.
getId
(),
submitter
,
submitterId
);
}
}
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
View file @
2fb00468
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
...
@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.EventMiddlewareDao
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
...
@@ -78,12 +79,12 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -78,12 +79,12 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
@Resource
(
name
=
"eventDao"
)
@Resource
(
name
=
"eventDao"
)
EventDao
eventDao
;
EventDao
eventDao
;
@Resource
(
name
=
"eventMiddlewareDao"
)
EventMiddlewareDao
eventMiddlewareDao
;
@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
{
...
@@ -729,14 +730,14 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -729,14 +730,14 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getOwnEvent
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getOwnEvent
()))
{
// 调用事件中间件时,使用项目id作为主品牌id
// 调用事件中间件时,使用项目id作为主品牌id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
ownEvents
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
ownEvents
=
event
Client
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
projectId
,
config
.
getEventTop
());
event
MiddlewareDao
.
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
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
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
())
{
contendId
=
Objects
.
equals
(
Constant
.
PRIMARY_CONTEND_ID
,
contendId
)
?
projectId
:
contendId
;
contendId
=
Objects
.
equals
(
Constant
.
PRIMARY_CONTEND_ID
,
contendId
)
?
projectId
:
contendId
;
contentEvents
.
addAll
(
event
Client
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
contendId
,
config
.
getEventTop
()));
contentEvents
.
addAll
(
event
MiddlewareDao
.
getEventsByProjectIdAndContendId
(
start
,
end
,
config
.
getOwnEvent
(),
projectId
,
contendId
,
config
.
getEventTop
()));
}
}
eventMap
.
put
(
"友商动态"
,
contentEvents
);
eventMap
.
put
(
"友商动态"
,
contentEvents
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
2fb00468
...
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.*
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.ReportDao
;
import
com.zhiwei.brandkbs2.dao.ReportSettingsDao
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.enmus.response.ReportCodeEnum
;
import
com.zhiwei.brandkbs2.enmus.response.ReportCodeEnum
;
...
@@ -82,6 +79,9 @@ public class ReportServiceImpl implements ReportService {
...
@@ -82,6 +79,9 @@ public class ReportServiceImpl implements ReportService {
@Resource
(
name
=
"indexServiceImpl"
)
@Resource
(
name
=
"indexServiceImpl"
)
IndexService
indexService
;
IndexService
indexService
;
@Resource
(
name
=
"eventMiddlewareDao"
)
EventMiddlewareDao
eventMiddlewareDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
@@ -91,9 +91,6 @@ public class ReportServiceImpl implements ReportService {
...
@@ -91,9 +91,6 @@ 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
<>();
...
@@ -395,7 +392,7 @@ public class ReportServiceImpl implements ReportService {
...
@@ -395,7 +392,7 @@ public class ReportServiceImpl implements ReportService {
//正面事件传播量top
//正面事件传播量top
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topPosEventList
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topPosEventList
=
event
Client
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
projectId
,
3
);
event
MiddlewareDao
.
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
));
...
@@ -413,7 +410,7 @@ public class ReportServiceImpl implements ReportService {
...
@@ -413,7 +410,7 @@ public class ReportServiceImpl implements ReportService {
//中性事件传播量top
//中性事件传播量top
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNeuEventList
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNeuEventList
=
event
Client
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
projectId
,
4
);
event
MiddlewareDao
.
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
));
...
@@ -431,7 +428,7 @@ public class ReportServiceImpl implements ReportService {
...
@@ -431,7 +428,7 @@ public class ReportServiceImpl implements ReportService {
//中性事件传播量top
//中性事件传播量top
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNegEventList
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topNegEventList
=
event
Client
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
projectId
,
4
);
event
MiddlewareDao
.
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
));
...
@@ -510,7 +507,7 @@ public class ReportServiceImpl implements ReportService {
...
@@ -510,7 +507,7 @@ public class ReportServiceImpl implements ReportService {
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
())
?
"负面事件"
:
"中性事件"
);
// 调用事件中间件时,主品牌id使用项目id
// 调用事件中间件时,主品牌id使用项目id
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
=
List
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
Event
>
topEventList
=
event
Client
.
getEventsByTotalChannelVolumeTop
(
startTime
,
endTime
,
emotion
,
projectId
,
projectId
,
10
);
event
MiddlewareDao
.
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
=
false
;
boolean
hasAnalyze
=
false
;
...
...
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