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
664182a0
Commit
664182a0
authored
Dec 26, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
Feature See merge request
!130
parents
5ab6de25
3099ff29
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
391 additions
and
16 deletions
+391
-16
pom.xml
+1
-1
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
+22
-2
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+102
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
+98
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+150
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
+8
-8
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+6
-1
No files found.
pom.xml
View file @
664182a0
...
@@ -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>
0
.0.1-SNAPSHOT
</event-client.version>
<event-client.version>
1
.0.1-SNAPSHOT
</event-client.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
...
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
View file @
664182a0
package
com
.
zhiwei
.
brandkbs2
.
common
;
package
com
.
zhiwei
.
brandkbs2
.
common
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.core.EventClientFactory
;
import
com.zhiwei.middleware.event.core.EventClientFactory
;
import
com.zhiwei.middleware.event.core.EventMonitorClient
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.mark.service.MarkerClient
;
import
com.zhiwei.middleware.mark.service.MarkerClient
;
import
okhttp3.OkHttpClient
;
import
okhttp3.OkHttpClient
;
...
@@ -54,12 +56,30 @@ public class CommonConfig {
...
@@ -54,12 +56,30 @@ public class CommonConfig {
}
}
/**
/**
* 获取事件中间件客户端
* 获取事件中间件
标签
客户端
*
*
* @return 事件中间件客户端
* @return 事件中间件
标签
客户端
*/
*/
@Bean
@Bean
public
EventTagClient
getEventTagClient
(){
public
EventTagClient
getEventTagClient
(){
return
EventClientFactory
.
markEventTagClient
(
eventClientRegistry
,
eventProviderGroup
,
appName
);
return
EventClientFactory
.
markEventTagClient
(
eventClientRegistry
,
eventProviderGroup
,
appName
);
}
}
/**
* 获取事件中间事件客户端
* @return 事件中间事件客户端
*/
@Bean
public
EventClient
getEventClient
(){
return
EventClientFactory
.
eventClient
(
eventClientRegistry
,
eventProviderGroup
,
appName
);
}
/**
* 获取事件中间件监测客户端
* @return 事件事件件监测客户端
*/
@Bean
public
EventMonitorClient
getEventMonitorClient
(){
return
EventClientFactory
.
eventMonitorClient
(
eventClientRegistry
,
eventProviderGroup
,
appName
);
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
View file @
664182a0
...
@@ -55,13 +55,13 @@ public class AppContendController extends BaseController {
...
@@ -55,13 +55,13 @@ public class AppContendController extends BaseController {
@ApiOperation
(
"竞品库-竞品分析-舆情总结页面"
)
@ApiOperation
(
"竞品库-竞品分析-舆情总结页面"
)
@PostMapping
(
"/summary"
)
@PostMapping
(
"/summary"
)
public
ResponseResult
getSummary
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
public
ResponseResult
getSummary
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
markSearchDTO
,
true
));
// 测试时关闭缓存,记得打开
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
markSearchDTO
,
true
));
}
}
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@PostMapping
(
"/spread/analyze"
)
@PostMapping
(
"/spread/analyze"
)
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
// 测试时关闭缓存,记得打开
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
}
}
@ApiOperation
(
"竞品库-竞品舆情-舆情导出"
)
@ApiOperation
(
"竞品库-竞品舆情-舆情导出"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
664182a0
...
@@ -3,11 +3,15 @@ package com.zhiwei.brandkbs2.controller.app;
...
@@ -3,11 +3,15 @@ package com.zhiwei.brandkbs2.controller.app;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
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.controller.BaseController
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
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.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.middleware.event.core.EventMonitorClient
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -17,6 +21,8 @@ import org.springframework.http.ResponseEntity;
...
@@ -17,6 +21,8 @@ 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
...
@@ -45,6 +51,9 @@ public class AppEventController extends BaseController {
...
@@ -45,6 +51,9 @@ 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
)
{
...
@@ -147,4 +156,97 @@ public class AppEventController extends BaseController {
...
@@ -147,4 +156,97 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
keyword
,
5
));
return
ResponseResult
.
success
(
eventService
.
getLastEventTop
(
keyword
,
5
));
}
}
@ApiOperation
(
"前台事件库-品牌事件库-获取品牌事件库筛选条件"
)
@GetMapping
(
"/listCriteria/{brandId}"
)
public
ResponseResult
getEventSearchCriteriaMiddleware
(
@PathVariable
String
brandId
){
return
ResponseResult
.
success
(
eventService
.
getEventListCriteria
(
brandId
));
}
@ApiOperation
(
"前台事件库-品牌事件库-获取品牌事件库事件列表"
)
@PostMapping
(
"/eventList"
)
public
ResponseResult
getEventListMiddleware
(
@RequestBody
BrandkbsEventSearchDTO
dto
){
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
@ApiOperation
(
"前台事件库-事件监测-获取事件标签选择条件"
)
@GetMapping
(
"/eventTagsCriteria"
)
public
ResponseResult
getEventTagsCriteria
(){
return
ResponseResult
.
success
(
eventService
.
getEventTagsCriteria
());
}
@ApiOperation
(
"前台事件库-事件监测-获取事件监测列表"
)
@GetMapping
(
"/eventMonitor"
)
public
ResponseResult
getEventMonitor
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
){
return
ResponseResult
.
success
(
eventService
.
getEventMonitor
(
page
,
pageSize
));
}
@ApiOperation
(
"前台事件库-事件监测-新增事件监测"
)
@PostMapping
(
"/addEventMonitor"
)
public
ResponseResult
addEventMonitor
(
@RequestBody
EventDTO
dto
){
if
(
eventMonitorClient
.
countMonitoringEventsBrandkbs
(
UserThreadLocal
.
getProjectId
())
>=
10
){
return
ResponseResult
.
failure
(
"监测事件数量不得超过10"
);
}
eventService
.
addEventMonitor
(
dto
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"前台事件库-事件监测-修改事件监测"
)
@PostMapping
(
"/modifyEventMonitor"
)
public
ResponseResult
modifyEventMonitor
(
@RequestBody
EventDTO
dto
){
eventService
.
modifyEventMonitor
(
dto
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"前台事件库-事件监测-结束事件监测"
)
@PutMapping
(
"/endEventMonitor/{eventId}"
)
public
ResponseResult
endEventMonitor
(
@PathVariable
String
eventId
){
eventService
.
endEventMonitor
(
eventId
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"前台事件库-事件监测-删除监测事件"
)
@PutMapping
(
"/deleteEventMonitor/{eventId}"
)
public
ResponseResult
deleteEventMonitor
(
@PathVariable
String
eventId
){
eventService
.
deleteEventMonitor
(
eventId
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"前台事件库-事件监测-获取监测中事件数量"
)
@PutMapping
(
"/countEventMonitor"
)
public
ResponseResult
getMonitoringEventsCount
(){
return
ResponseResult
.
success
(
eventService
.
getMonitoringEventsCount
());
}
@ApiOperation
(
"前台事件库-事件详情-获取事件基础信息"
)
@GetMapping
(
"/detail/baseInfo"
)
public
ResponseResult
eventBaseInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventBaseInfo
(
eventId
));
}
@ApiOperation
(
"前台事件库-事件详情-获取传播趋势图"
)
@GetMapping
(
"/detail/dissemination-trends"
)
public
ResponseResult
eventDisseminationTrends
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"小时"
)
String
type
){
return
ResponseResult
.
success
(
eventService
.
eventDisseminationTrends
(
eventId
,
type
));
}
@ApiOperation
(
"前台事件库-事件详情-渠道发声"
)
@GetMapping
(
"/detail/channel-voices"
)
public
ResponseResult
eventChannelVoices
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"重要渠道"
)
String
type
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
pageSize
,
@RequestParam
(
value
=
"sorter"
,
required
=
false
)
String
sorter
){
return
ResponseResult
.
success
(
eventService
.
eventChannelVoices
(
eventId
,
type
,
page
,
pageSize
,
sorter
));
}
@ApiOperation
(
"前台事件库-事件详情-热门文章分析"
)
@GetMapping
(
"/detail/top-articles-analysis"
)
public
ResponseResult
eventTopArticlesAnalysis
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"按时间"
)
String
type
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"全部"
)
String
emotion
,
@RequestParam
(
value
=
"aggTitle"
,
required
=
false
)
String
aggTitle
){
return
ResponseResult
.
success
(
eventService
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
));
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
664182a0
...
@@ -84,7 +84,7 @@ public class AppHotController extends BaseController {
...
@@ -84,7 +84,7 @@ public class AppHotController extends BaseController {
Object
data
=
jsonObjectResponseEntity
.
getBody
().
get
(
"data"
);
Object
data
=
jsonObjectResponseEntity
.
getBody
().
get
(
"data"
);
String
redisKey
=
RedisKeyPrefix
.
HOT_LIST
+
type
;
String
redisKey
=
RedisKeyPrefix
.
HOT_LIST
+
type
;
String
result
=
redisUtil
.
get
(
redisKey
);
String
result
=
redisUtil
.
get
(
redisKey
);
//当舆论场崩溃时从缓存里获取
//
当舆论场崩溃时从缓存里获取
if
(
Objects
.
nonNull
(
data
))
{
if
(
Objects
.
nonNull
(
data
))
{
if
(
Objects
.
isNull
(
result
))
{
if
(
Objects
.
isNull
(
result
))
{
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
data
),
ONE_HOUR
,
TimeUnit
.
HOURS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
data
),
ONE_HOUR
,
TimeUnit
.
HOURS
);
...
@@ -105,7 +105,7 @@ public class AppHotController extends BaseController {
...
@@ -105,7 +105,7 @@ public class AppHotController extends BaseController {
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
String
redisKey
=
RedisKeyPrefix
.
HOT_RANK_LIST
;
String
redisKey
=
RedisKeyPrefix
.
HOT_RANK_LIST
;
String
result
=
redisUtil
.
get
(
redisKey
);
String
result
=
redisUtil
.
get
(
redisKey
);
//当舆论场崩溃时从缓存里获取
//
当舆论场崩溃时从缓存里获取
if
(
jsonObject
.
getBoolean
(
"state"
))
{
if
(
jsonObject
.
getBoolean
(
"state"
))
{
Object
data
=
jsonObject
.
get
(
"data"
);
Object
data
=
jsonObject
.
get
(
"data"
);
if
(
Objects
.
isNull
(
result
))
{
if
(
Objects
.
isNull
(
result
))
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
View file @
664182a0
...
@@ -13,6 +13,11 @@ import com.zhiwei.brandkbs2.pojo.vo.EventListInfoVO;
...
@@ -13,6 +13,11 @@ import com.zhiwei.brandkbs2.pojo.vo.EventListInfoVO;
import
com.zhiwei.brandkbs2.pojo.vo.EventVO
;
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.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.vo.EventTagBrandkbsVO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -296,4 +301,97 @@ public interface EventService {
...
@@ -296,4 +301,97 @@ public interface EventService {
*/
*/
void
updateAllEventInfo
();
void
updateAllEventInfo
();
/**
* 事件中间件获取品牌事件列表筛选条件
* @return
*/
JSONObject
getEventListCriteria
(
String
brandId
);
/**
* 事件中间件获取品牌事件列表
* @param dto 事件搜索条件类
* @return
*/
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventListInfoVO
>
getEventListMiddleware
(
BrandkbsEventSearchDTO
dto
);
/**
* 事件中间件获取获取事件标签选择条件
* @return
*/
List
<
EventTagBrandkbsVO
>
getEventTagsCriteria
();
/**
* 事件中间件获取事件监测列表
* @param page 页码
* @param pageSize 页大小
* @return
*/
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventVO
>
getEventMonitor
(
int
page
,
int
pageSize
);
/**
* 事件中间件新增事件监测
* @param dto 事件传输实体
*/
void
addEventMonitor
(
EventDTO
dto
);
/**
* 事件中间件编辑单个事件监测
* @param dto 事件传输实体
*/
void
modifyEventMonitor
(
EventDTO
dto
);
/**
* 事件中间件结束事件监测
* @param eventId 事件id
*/
void
endEventMonitor
(
String
eventId
);
/**
* 事件中间件删除事件监测事件
* @param eventId 事件id
*/
void
deleteEventMonitor
(
String
eventId
);
/**
* 事件中间件统计状态监测中的事件
* @return
*/
Long
getMonitoringEventsCount
();
/**
* 事件中间件获取事件基础信息
* @param eventId 事件id
* @return
*/
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
);
/**
* 事件中间件获取传播趋势
* @param eventId 事件id
* @param type 小时/天
* @return
*/
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
);
/**
* 事件中间件获取渠道发声
* @param eventId 事件id
* @param type 重要渠道/全部
* @param page 页码
* @param pageSize 页大小
* @param sorter 排序方式
* @return
*/
PageData
<
JSONObject
>
eventChannelVoices
(
String
eventId
,
String
type
,
int
page
,
int
pageSize
,
String
sorter
);
/**
* 事件中间件获取热门文章分析
* @param eventId 事件id
* @param type 按时间/按数量
* @param emotion 情感倾向
* @param aggTitle 聚合标题
* @return
*/
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
664182a0
...
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
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.EventDao
;
...
@@ -33,9 +35,20 @@ import com.zhiwei.brandkbs2.pojo.vo.*;
...
@@ -33,9 +35,20 @@ import com.zhiwei.brandkbs2.pojo.vo.*;
import
com.zhiwei.brandkbs2.service.EventDataService
;
import
com.zhiwei.brandkbs2.service.EventDataService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.UserService
;
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.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.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
com.zhiwei.middleware.event.pojo.vo.EventTagBrandkbsVO
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.collections4.ListUtils
;
...
@@ -53,9 +66,12 @@ import org.springframework.data.redis.core.StringRedisTemplate;
...
@@ -53,9 +66,12 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
...
@@ -101,15 +117,30 @@ public class EventServiceImpl implements EventService {
...
@@ -101,15 +117,30 @@ public class EventServiceImpl implements EventService {
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
private
ProjectService
projectService
;
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
@Value
(
"${jwt.key}"
)
private
String
jwtKey
;
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@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
;
...
@@ -713,6 +744,125 @@ public class EventServiceImpl implements EventService {
...
@@ -713,6 +744,125 @@ public class EventServiceImpl implements EventService {
}
}
}
}
@Override
public
JSONObject
getEventListCriteria
(
String
brandId
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
JSONObject
result
=
new
JSONObject
();
// 品牌
result
.
put
(
"brands"
,
projectService
.
getBrands
(
projectId
,
true
));
// 事件调性
AbstractProject
abstractProject
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
brandId
);
List
<
EventTagBrandkbsVO
>
eventTags
=
(
List
<
EventTagBrandkbsVO
>)
eventTagClient
.
getEventTagGroupInfoBrandkbs
(
abstractProject
.
getBrandLinkedGroupId
()).
getData
();
List
<
EventTagBrandkbsVO
>
emotion
=
eventTags
.
stream
().
filter
(
eventTag
->
EventTagEnum
.
EVENT_ATTRIBUTE
.
getName
().
equals
(
eventTag
.
getGroupName
())).
collect
(
Collectors
.
toList
());
result
.
put
(
"emotions"
,
emotion
);
// 时间
result
.
put
(
"times"
,
getDefaultTimes
());
// 传播量
result
.
put
(
"totalDisseminationVolume"
,
getDefaultVolumes
());
return
result
;
}
@Override
public
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventListInfoVO
>
getEventListMiddleware
(
BrandkbsEventSearchDTO
dto
)
{
if
(
Constant
.
PRIMARY_CONTEND_ID
.
equals
(
dto
.
getBrandId
())){
dto
.
setBrandId
(
UserThreadLocal
.
getProjectId
());
}
return
eventClient
.
getEventListBrandkbs
(
dto
);
}
@Override
public
List
<
EventTagBrandkbsVO
>
getEventTagsCriteria
()
{
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
return
(
List
<
EventTagBrandkbsVO
>)
eventTagClient
.
getEventTagGroupInfoBrandkbs
(
project
.
getBrandLinkedGroupId
()).
getData
();
}
@Override
public
PageData
<
com
.
zhiwei
.
middleware
.
event
.
pojo
.
vo
.
EventVO
>
getEventMonitor
(
int
page
,
int
pageSize
)
{
return
eventMonitorClient
.
getEventMonitorBrandkbs
(
UserThreadLocal
.
getProjectId
(),
page
,
pageSize
);
}
@Override
public
void
addEventMonitor
(
EventDTO
dto
)
{
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
// submitter submitterId
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
Objects
.
requireNonNull
(
requestAttributes
).
getRequest
();
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
project
.
getId
()).
getNickname
();
// 事件基础信息
dto
.
setProject
(
project
.
getBrandLinkedGroup
());
dto
.
setProjectId
(
project
.
getBrandLinkedGroupId
());
dto
.
setSubmitter
(
submitter
);
dto
.
setSubmitterId
(
submitterId
);
// 数据源
dto
.
setDataSource
(
project
.
getBrandLinkedGroup
());
// 品见关联信息
List
<
BrandkbsBasicInfo
>
brandkbsBasicInfos
=
new
ArrayList
<>(
1
);
BrandkbsBasicInfo
brandkbsBasicInfo
=
new
BrandkbsBasicInfo
();
brandkbsBasicInfo
.
setBrandkbsProject
(
project
.
getProjectName
());
brandkbsBasicInfo
.
setBrandkbsProjectId
(
project
.
getId
());
brandkbsBasicInfo
.
setBrandkbsBrand
(
project
.
getBrandName
());
// 主品牌品牌id使用项目id
brandkbsBasicInfo
.
setBrandkbsBrandId
(
project
.
getId
());
brandkbsBasicInfos
.
add
(
brandkbsBasicInfo
);
dto
.
setBrandkbsInfos
(
brandkbsBasicInfos
);
eventMonitorClient
.
addEventMonitor
(
dto
);
}
@Override
public
void
modifyEventMonitor
(
EventDTO
dto
)
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
Objects
.
requireNonNull
(
requestAttributes
).
getRequest
();
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
dto
.
setProjectId
(
project
.
getBrandLinkedGroupId
());
dto
.
setSubmitter
(
submitter
);
dto
.
setSubmitterId
(
submitterId
);
eventMonitorClient
.
modifyEventMonitor
(
dto
.
getId
(),
dto
,
null
);
}
@Override
public
void
endEventMonitor
(
String
eventId
)
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
Objects
.
requireNonNull
(
requestAttributes
).
getRequest
();
String
submitterId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
UserThreadLocal
.
getProjectId
()).
getNickname
();
eventMonitorClient
.
endEventMonitor
(
eventId
,
submitter
,
submitterId
);
}
@Override
public
void
deleteEventMonitor
(
String
eventId
)
{
eventClient
.
deleteEvent
(
eventId
);
}
@Override
public
Long
getMonitoringEventsCount
()
{
return
eventMonitorClient
.
countMonitoringEventsBrandkbs
(
UserThreadLocal
.
getProjectId
());
}
@Override
public
EventBaseInfoDTO
eventBaseInfo
(
String
eventId
)
{
return
eventClient
.
eventBaseInfo
(
eventId
);
}
@Override
public
com
.
zhiwei
.
middleware
.
event
.
pojo
.
entity
.
EventDisseminationTrend
eventDisseminationTrends
(
String
eventId
,
String
type
)
{
return
eventClient
.
eventDisseminationTrends
(
eventId
,
type
);
}
@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
JSONObject
eventTopArticlesAnalysis
(
String
eventId
,
String
type
,
String
emotion
,
String
aggTitle
)
{
return
eventClient
.
eventTopArticlesAnalysis
(
eventId
,
type
,
emotion
,
aggTitle
);
}
@Data
@Data
public
static
class
MongoQueryUtil
{
public
static
class
MongoQueryUtil
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
View file @
664182a0
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
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.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.enmus.response.ProjectCodeEnum
;
import
com.zhiwei.brandkbs2.enmus.response.ProjectCodeEnum
;
...
@@ -35,7 +34,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
...
@@ -35,7 +34,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -95,10 +93,10 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -95,10 +93,10 @@ public class ProjectServiceImpl implements ProjectService {
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
,
project
.
getId
()).
getNickname
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
project
.
getId
()).
getNickname
();
// 主品牌绑定事件标签
// 主品牌绑定事件标签
,主品牌品牌id使用项目id
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
eventTagClient
.
bindBrandkbs
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
eventTagClient
.
bindBrandkbs
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
Constant
.
PRIMARY_CONTEND_ID
,
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
))
{
...
@@ -115,6 +113,7 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -115,6 +113,7 @@ public class ProjectServiceImpl implements ProjectService {
Query
query
=
new
Query
();
Query
query
=
new
Query
();
projectDao
.
addKeywordFuzz
(
query
,
keyword
,
"projectName"
);
projectDao
.
addKeywordFuzz
(
query
,
keyword
,
"projectName"
);
long
count
=
projectDao
.
count
(
query
);
long
count
=
projectDao
.
count
(
query
);
projectDao
.
addSort
(
query
,
"{\"cTime\":\"descend\"}"
);
mongoUtil
.
start
(
page
,
size
,
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
Project
>
projectList
=
projectDao
.
findList
(
query
);
List
<
Project
>
projectList
=
projectDao
.
findList
(
query
);
List
<
JSONObject
>
resList
=
projectList
.
stream
().
map
(
project
->
{
List
<
JSONObject
>
resList
=
projectList
.
stream
().
map
(
project
->
{
...
@@ -148,7 +147,9 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -148,7 +147,9 @@ public class ProjectServiceImpl implements ProjectService {
Map
<
String
,
List
<
EventTagRelatedDTO
>>
eventTagsMap
=
(
Map
<
String
,
List
<
EventTagRelatedDTO
>>)
eventTagClient
.
getBrandkbsBindingEventTags
(
pid
).
getData
();
Map
<
String
,
List
<
EventTagRelatedDTO
>>
eventTagsMap
=
(
Map
<
String
,
List
<
EventTagRelatedDTO
>>)
eventTagClient
.
getBrandkbsBindingEventTags
(
pid
).
getData
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
new
ArrayList
<>();
List
<
EventTagRelatedDTO
>
eventTagsList
=
new
ArrayList
<>();
if
(!
Tools
.
isEmpty
(
eventTagsMap
))
{
if
(!
Tools
.
isEmpty
(
eventTagsMap
))
{
eventTagsList
=
eventTagsMap
.
get
(
Constant
.
PRIMARY_CONTEND_ID
);
// 获取主品牌标签
eventTagsList
=
eventTagsMap
.
get
(
projectVO
.
getId
());
// 获取竞品标签
List
<
Contend
>
contendList
=
projectVO
.
getContendList
();
List
<
Contend
>
contendList
=
projectVO
.
getContendList
();
if
(!
Tools
.
isEmpty
(
contendList
))
{
if
(!
Tools
.
isEmpty
(
contendList
))
{
for
(
Contend
contend
:
contendList
)
{
for
(
Contend
contend
:
contendList
)
{
...
@@ -160,7 +161,6 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -160,7 +161,6 @@ public class ProjectServiceImpl implements ProjectService {
return
projectVO
;
return
projectVO
;
}
}
@Override
@Override
public
Project
getProjectById
(
String
pid
)
{
public
Project
getProjectById
(
String
pid
)
{
return
projectDao
.
findOneById
(
pid
);
return
projectDao
.
findOneById
(
pid
);
...
@@ -187,10 +187,10 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -187,10 +187,10 @@ public class ProjectServiceImpl implements ProjectService {
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
,
project
.
getId
()).
getNickname
();
String
submitter
=
userService
.
queryUserInfo
(
submitterId
,
project
.
getId
()).
getNickname
();
// 主品牌修改绑定事件标签
// 主品牌修改绑定事件标签
, 主品牌id使用项目id
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
List
<
EventTagRelatedDTO
>
eventTagsList
=
projectVO
.
getEventTagsList
();
eventTagClient
.
modifyBrandkbsEventTags
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
eventTagClient
.
modifyBrandkbsEventTags
(
project
.
getBrandLinkedGroup
(),
project
.
getBrandLinkedGroupId
(),
eventTagsList
,
project
.
getProjectName
(),
project
.
getId
(),
project
.
getBrandName
(),
Constant
.
PRIMARY_CONTEND_ID
,
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
))
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
664182a0
...
@@ -173,7 +173,12 @@ public class UserServiceImpl implements UserService {
...
@@ -173,7 +173,12 @@ public class UserServiceImpl implements UserService {
user
.
getRoles
().
stream
().
filter
(
userRoles
->
userRoles
.
getProjectId
().
equals
(
userDTO
.
getProjectId
())).
findAny
().
ifPresent
(
userRole
->
{
user
.
getRoles
().
stream
().
filter
(
userRoles
->
userRoles
.
getProjectId
().
equals
(
userDTO
.
getProjectId
())).
findAny
().
ifPresent
(
userRole
->
{
// 更新原userRole
// 更新原userRole
userRole
.
setRoleId
(
userDTO
.
getRoleId
());
userRole
.
setRoleId
(
userDTO
.
getRoleId
());
OptionalLong
.
of
(
userDTO
.
getExpiredTime
()).
ifPresent
(
userRole:
:
setExpiredTime
);
// 权限用户以上则清空过期时间
if
(
userDTO
.
getRoleId
()
<
RoleEnum
.
CUSTOMER
.
getState
())
{
userRole
.
setExpiredTime
(
null
);
}
else
{
OptionalLong
.
of
(
userDTO
.
getExpiredTime
()).
ifPresent
(
userRole:
:
setExpiredTime
);
}
OptionalInt
.
of
(
userDTO
.
getExportAmount
()).
ifPresent
(
userRole:
:
setExportAmount
);
OptionalInt
.
of
(
userDTO
.
getExportAmount
()).
ifPresent
(
userRole:
:
setExportAmount
);
userDao
.
updateOneByIdWithField
(
userDTO
.
getId
(),
new
Update
().
set
(
"roles"
,
roles
));
userDao
.
updateOneByIdWithField
(
userDTO
.
getId
(),
new
Update
().
set
(
"roles"
,
roles
));
});
});
...
...
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