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
f5708c01
Commit
f5708c01
authored
Jan 31, 2024
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
事件库模块优化调整
parent
f4a353db
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
134 additions
and
17 deletions
+134
-17
pom.xml
+1
-1
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+1
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
+5
-4
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+19
-7
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
+6
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
+14
-0
src/main/java/com/zhiwei/brandkbs2/service/TaskService.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+57
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+15
-0
src/main/java/com/zhiwei/brandkbs2/task/ControlCenter.java
+2
-1
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
+4
-0
No files found.
pom.xml
View file @
f5708c01
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<dubbo.version>
2.7.4.1
</dubbo.version>
<dubbo.version>
2.7.4.1
</dubbo.version>
<curator.version>
2.12.0
</curator.version>
<curator.version>
2.12.0
</curator.version>
<push.log.version>
2.17.0-SNAPSHOT
</push.log.version>
<push.log.version>
2.17.0-SNAPSHOT
</push.log.version>
<event-client.version>
1.0.9.
6
-SNAPSHOT
</event-client.version>
<event-client.version>
1.0.9.
8
-SNAPSHOT
</event-client.version>
<cleaner-unified-filter.version>
1.1.5-SNAPSHOT
</cleaner-unified-filter.version>
<cleaner-unified-filter.version>
1.1.5-SNAPSHOT
</cleaner-unified-filter.version>
</properties>
</properties>
...
...
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
f5708c01
...
@@ -56,6 +56,7 @@ public class RedisKeyPrefix {
...
@@ -56,6 +56,7 @@ public class RedisKeyPrefix {
public
static
final
String
CUSTOM_EVENT_LIST
=
"BRANDKBS:CUSTOM_EVENT:LIST:"
;
public
static
final
String
CUSTOM_EVENT_LIST
=
"BRANDKBS:CUSTOM_EVENT:LIST:"
;
public
static
final
String
CUSTOM_EVENT_ANALYZE_SHARE
=
"BRANDKBS:CUSTOM_EVENT:SHARE:"
;
public
static
final
String
CUSTOM_EVENT_ANALYZE_SHARE
=
"BRANDKBS:CUSTOM_EVENT:SHARE:"
;
public
static
final
String
CUSTOM_EVENT_ANALYZE
=
"BRANDKBS:CUSTOM_EVENT:ANALYZE:"
;
public
static
final
String
CUSTOM_EVENT_ANALYZE
=
"BRANDKBS:CUSTOM_EVENT:ANALYZE:"
;
public
static
final
String
EVENT_AGG_TITLE_LIST
=
"BRANDKBS:EVENT:AGG_TITLE:LIST:"
;
/**
/**
* 热点相关缓存KEY
* 热点相关缓存KEY
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
View file @
f5708c01
...
@@ -57,7 +57,7 @@ public class AppArticleController extends BaseController {
...
@@ -57,7 +57,7 @@ public class AppArticleController extends BaseController {
@ApiOperation
(
"原始数据列表"
)
@ApiOperation
(
"原始数据列表"
)
@PostMapping
(
"/origin/list"
)
@PostMapping
(
"/origin/list"
)
@LogRecord
(
description
=
"舆情库-原始数据
列表
"
)
@LogRecord
(
description
=
"舆情库-原始数据"
)
public
ResponseResult
getOriginList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
public
ResponseResult
getOriginList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getOriginList
(
markSearchDTO
));
return
ResponseResult
.
success
(
markDataService
.
getOriginList
(
markSearchDTO
));
}
}
...
@@ -117,14 +117,14 @@ public class AppArticleController extends BaseController {
...
@@ -117,14 +117,14 @@ public class AppArticleController extends BaseController {
@ApiOperation
(
"舆情列表"
)
@ApiOperation
(
"舆情列表"
)
@PostMapping
(
"/mark/list"
)
@PostMapping
(
"/mark/list"
)
@LogRecord
(
description
=
"舆情库-舆情
列表
"
)
@LogRecord
(
description
=
"舆情库-舆情
数据
"
)
public
ResponseResult
getYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
public
ResponseResult
getYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
}
}
@ApiOperation
(
"舆情列表-生成聚合"
)
@ApiOperation
(
"舆情列表-生成聚合"
)
@PostMapping
(
"/mark/aggree"
)
@PostMapping
(
"/mark/aggree"
)
@LogRecord
(
description
=
"舆情库-
舆情列表
-聚合"
)
@LogRecord
(
description
=
"舆情库-
有效舆情
-聚合"
)
public
ResponseResult
generateYuqingMarkAggreeList
(
@RequestBody
JSONObject
info
)
{
public
ResponseResult
generateYuqingMarkAggreeList
(
@RequestBody
JSONObject
info
)
{
Long
startTime
=
info
.
getLong
(
"startTime"
);
Long
startTime
=
info
.
getLong
(
"startTime"
);
Long
endTime
=
info
.
getLong
(
"endTime"
);
Long
endTime
=
info
.
getLong
(
"endTime"
);
...
@@ -188,7 +188,7 @@ public class AppArticleController extends BaseController {
...
@@ -188,7 +188,7 @@ public class AppArticleController extends BaseController {
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
)
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
)
})
})
@LogRecord
(
description
=
"舆情库-舆情分析"
)
//
@LogRecord(description = "舆情库-舆情分析")
@GetMapping
(
"/emotion/proportion"
)
@GetMapping
(
"/emotion/proportion"
)
public
ResponseResult
getMarkEmotionProportion
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
public
ResponseResult
getMarkEmotionProportion
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
...
@@ -448,6 +448,7 @@ public class AppArticleController extends BaseController {
...
@@ -448,6 +448,7 @@ public class AppArticleController extends BaseController {
@ApiOperation
(
"新-舆情分析-舆情总量"
)
@ApiOperation
(
"新-舆情分析-舆情总量"
)
@GetMapping
(
"/analyze/amount"
)
@GetMapping
(
"/analyze/amount"
)
@LogRecord
(
description
=
"舆情库-舆情分析"
)
public
ResponseResult
getYuqingAmount
(
@RequestParam
(
value
=
"startTime"
)
Long
startTime
,
public
ResponseResult
getYuqingAmount
(
@RequestParam
(
value
=
"startTime"
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
)
Long
endTime
,
@RequestParam
(
value
=
"endTime"
)
Long
endTime
,
@RequestParam
(
value
=
"planId"
,
required
=
false
)
String
planId
)
{
@RequestParam
(
value
=
"planId"
,
required
=
false
)
String
planId
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
f5708c01
...
@@ -4,13 +4,11 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,13 +4,11 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.aop.LogRecord
;
import
com.zhiwei.brandkbs2.aop.LogRecord
;
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.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
com.zhiwei.middleware.event.pojo.dto.EventDTO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -142,7 +140,7 @@ public class AppEventController extends BaseController {
...
@@ -142,7 +140,7 @@ public class AppEventController extends BaseController {
}
}
@ApiOperation
(
"前台事件库-全网事件库-行业热点-列表"
)
@ApiOperation
(
"前台事件库-全网事件库-行业热点-列表"
)
@LogRecord
(
description
=
"事件库-全网事件库
-行业热点
"
)
@LogRecord
(
description
=
"事件库-全网事件库"
)
@GetMapping
(
"/getWholeNetworkEventsList"
)
@GetMapping
(
"/getWholeNetworkEventsList"
)
public
ResponseResult
getWholeNetworkEventsList
(
@RequestParam
(
value
=
"firstType"
,
required
=
false
,
defaultValue
=
""
)
String
firstType
,
public
ResponseResult
getWholeNetworkEventsList
(
@RequestParam
(
value
=
"firstType"
,
required
=
false
,
defaultValue
=
""
)
String
firstType
,
@RequestParam
(
value
=
"start"
,
required
=
false
,
defaultValue
=
"0"
)
long
start
,
@RequestParam
(
value
=
"start"
,
required
=
false
,
defaultValue
=
"0"
)
long
start
,
...
@@ -187,7 +185,7 @@ public class AppEventController extends BaseController {
...
@@ -187,7 +185,7 @@ public class AppEventController extends BaseController {
}
}
@ApiOperation
(
"前台事件库-全网事件库-企业危机-危机库列表"
)
@ApiOperation
(
"前台事件库-全网事件库-企业危机-危机库列表"
)
@LogRecord
(
description
=
"事件库-
全网事件库-企业危机
"
)
@LogRecord
(
description
=
"事件库-
危机案例库
"
)
@GetMapping
(
"/crisisList"
)
@GetMapping
(
"/crisisList"
)
public
ResponseResult
crisisList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
public
ResponseResult
crisisList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
...
@@ -221,7 +219,7 @@ public class AppEventController extends BaseController {
...
@@ -221,7 +219,7 @@ public class AppEventController extends BaseController {
}
}
@ApiOperation
(
"前台事件库-品牌事件库-获取品牌事件库事件列表"
)
@ApiOperation
(
"前台事件库-品牌事件库-获取品牌事件库事件列表"
)
@LogRecord
(
description
=
"事件库-品牌事件库"
)
@LogRecord
(
description
=
"事件库-品牌事件库
-事件中心
"
)
@PostMapping
(
"/eventList"
)
@PostMapping
(
"/eventList"
)
public
ResponseResult
getEventListMiddleware
(
@RequestBody
BrandkbsEventSearchDTO
dto
){
public
ResponseResult
getEventListMiddleware
(
@RequestBody
BrandkbsEventSearchDTO
dto
){
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
...
@@ -234,7 +232,7 @@ public class AppEventController extends BaseController {
...
@@ -234,7 +232,7 @@ public class AppEventController extends BaseController {
}
}
@ApiOperation
(
"前台事件库-事件监测-获取事件监测列表"
)
@ApiOperation
(
"前台事件库-事件监测-获取事件监测列表"
)
@LogRecord
(
description
=
"事件库-事件
分析
"
)
@LogRecord
(
description
=
"事件库-事件
监测
"
)
@GetMapping
(
"/eventMonitor"
)
@GetMapping
(
"/eventMonitor"
)
public
ResponseResult
getEventMonitor
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
public
ResponseResult
getEventMonitor
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
){
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
){
...
@@ -280,7 +278,7 @@ public class AppEventController extends BaseController {
...
@@ -280,7 +278,7 @@ public class AppEventController extends BaseController {
@ApiOperation
(
"前台事件库-事件详情-获取事件基础信息"
)
@ApiOperation
(
"前台事件库-事件详情-获取事件基础信息"
)
@GetMapping
(
"/detail/baseInfo"
)
@GetMapping
(
"/detail/baseInfo"
)
@LogRecord
(
values
=
"title"
,
description
=
"事件库-品牌事件库"
,
arguments
=
false
,
entity
=
true
)
@LogRecord
(
values
=
"title"
,
description
=
"事件库-品牌事件库
-事件中心
"
,
arguments
=
false
,
entity
=
true
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventBaseInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
public
ResponseResult
eventBaseInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventBaseInfo
(
eventId
));
return
ResponseResult
.
success
(
eventService
.
eventBaseInfo
(
eventId
));
...
@@ -343,4 +341,18 @@ public class AppEventController extends BaseController {
...
@@ -343,4 +341,18 @@ public class AppEventController extends BaseController {
List
<
String
>
eventIds
=
json
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
);
List
<
String
>
eventIds
=
json
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
);
return
ResponseResult
.
success
(
eventService
.
scheduleEventStatus
(
eventIds
));
return
ResponseResult
.
success
(
eventService
.
scheduleEventStatus
(
eventIds
));
}
}
@ApiOperation
(
"前台事件库-品牌事件库标题聚合分析"
)
@GetMapping
(
"/analyze/aggregate-titles"
)
@LogRecord
(
description
=
"事件库-品牌事件库-标题聚合分析"
)
public
ResponseResult
getLastNews
(
@RequestParam
(
value
=
"startTime"
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
)
Long
endTime
)
{
return
ResponseResult
.
success
(
eventService
.
getEventAggTitleList
(
startTime
,
endTime
,
false
));
}
@ApiOperation
(
"前台事件库-品牌事件库-分析"
)
@PostMapping
(
"/analyze"
)
public
ResponseResult
aggTitleAnalyze
(
@RequestBody
EventDTO
dto
){
return
eventService
.
aggTitleAnalyze
(
dto
);
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/EventMiddlewareDao.java
View file @
f5708c01
...
@@ -338,4 +338,10 @@ public interface EventMiddlewareDao {
...
@@ -338,4 +338,10 @@ public interface EventMiddlewareDao {
* @return
* @return
*/
*/
ReturnData
scheduleEventStatus
(
List
<
String
>
eventIds
);
ReturnData
scheduleEventStatus
(
List
<
String
>
eventIds
);
/**
* 添加新事件
* @param eventDTO 事件传输类
*/
ReturnData
addEvent
(
EventDTO
eventDTO
);
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventMiddlewareDaoImpl.java
View file @
f5708c01
...
@@ -231,4 +231,9 @@ public class EventMiddlewareDaoImpl implements EventMiddlewareDao {
...
@@ -231,4 +231,9 @@ public class EventMiddlewareDaoImpl implements EventMiddlewareDao {
public
ReturnData
scheduleEventStatus
(
List
<
String
>
eventIds
)
{
public
ReturnData
scheduleEventStatus
(
List
<
String
>
eventIds
)
{
return
eventMonitorClient
.
scheduleEventStatus
(
eventIds
);
return
eventMonitorClient
.
scheduleEventStatus
(
eventIds
);
}
}
@Override
public
ReturnData
addEvent
(
EventDTO
eventDTO
)
{
return
eventClient
.
addEvent
(
eventDTO
);
}
}
}
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
View file @
f5708c01
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDataDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDataDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDTO
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.EventDisseminationTrend
;
import
com.zhiwei.brandkbs2.pojo.EventDisseminationTrend
;
import
com.zhiwei.brandkbs2.pojo.dto.EventDataDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventDataDTO
;
...
@@ -436,4 +437,17 @@ public interface EventService {
...
@@ -436,4 +437,17 @@ public interface EventService {
* @return
* @return
*/
*/
JSONObject
scheduleEventStatus
(
List
<
String
>
eventIds
);
JSONObject
scheduleEventStatus
(
List
<
String
>
eventIds
);
/**
* 品牌事件库-聚合标题列表
* @param startTime
* @param endTime
* @return
*/
List
<
JSONObject
>
getEventAggTitleList
(
Long
startTime
,
Long
endTime
,
boolean
cache
);
/**
* 品牌事件库-标题聚合分析-分析
*/
ResponseResult
aggTitleAnalyze
(
EventDTO
eventDTO
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/TaskService.java
View file @
f5708c01
...
@@ -29,6 +29,11 @@ public interface TaskService{
...
@@ -29,6 +29,11 @@ public interface TaskService{
void
customEventCache
();
void
customEventCache
();
/**
/**
* 事件标题聚合分析缓存
*/
void
eventAggTitleCache
();
/**
* 生成简报任务并推送
* 生成简报任务并推送
*/
*/
void
generateReportAndSend
();
void
generateReportAndSend
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
f5708c01
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
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
;
...
@@ -23,15 +24,13 @@ import com.zhiwei.brandkbs2.enmus.response.EventCodeEnum;
...
@@ -23,15 +24,13 @@ import com.zhiwei.brandkbs2.enmus.response.EventCodeEnum;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.dto.EventDataDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventDataDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.YqEventDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.YqEventDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.*
;
import
com.zhiwei.brandkbs2.pojo.vo.*
;
import
com.zhiwei.brandkbs2.service.EventDataService
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.service.EventService
;
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
;
...
@@ -115,6 +114,9 @@ public class EventServiceImpl implements EventService {
...
@@ -115,6 +114,9 @@ public class EventServiceImpl implements EventService {
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
private
ProjectService
projectService
;
@Resource
(
name
=
"markDataServiceImpl"
)
MarkDataService
markDataService
;
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
private
UserService
userService
;
...
@@ -893,6 +895,57 @@ public class EventServiceImpl implements EventService {
...
@@ -893,6 +895,57 @@ public class EventServiceImpl implements EventService {
return
(
JSONObject
)
eventMiddlewareDao
.
scheduleEventStatus
(
eventIds
).
getData
();
return
(
JSONObject
)
eventMiddlewareDao
.
scheduleEventStatus
(
eventIds
).
getData
();
}
}
@Override
public
List
<
JSONObject
>
getEventAggTitleList
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
redisKey
=
RedisUtil
.
getEventAggTitleListKEY
(
projectId
,
startTime
,
endTime
);
String
resultStr
=
redisUtil
.
get
(
redisKey
);
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
List
<
JSONObject
>
resultList
=
markDataService
.
getLastNews
(
startTime
,
endTime
,
null
,
50
,
true
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resultList
));
return
resultList
;
}
@Override
public
ResponseResult
aggTitleAnalyze
(
EventDTO
dto
)
{
long
now
=
System
.
currentTimeMillis
();
if
(
now
<
dto
.
getEndTime
()
&&
getMonitoringEventsCount
()
>=
5
){
return
ResponseResult
.
failure
(
"结束时间为未来时间判断为监测事件,监测事件数量不得超过5"
);
}
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
);
// 结束时间大于当前时间为监测事件
if
(
now
<
dto
.
getEndTime
())
{
eventMiddlewareDao
.
addEventMonitor
(
dto
);
return
ResponseResult
.
success
();
}
eventMiddlewareDao
.
addEvent
(
dto
);
return
ResponseResult
.
success
();
}
@Data
@Data
public
static
class
MongoQueryUtil
{
public
static
class
MongoQueryUtil
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
f5708c01
...
@@ -210,6 +210,21 @@ public class TaskServiceImpl implements TaskService {
...
@@ -210,6 +210,21 @@ public class TaskServiceImpl implements TaskService {
},
cacheServiceExecutor
)).
toArray
(
CompletableFuture
[]::
new
)).
join
();
},
cacheServiceExecutor
)).
toArray
(
CompletableFuture
[]::
new
)).
join
();
}
}
@Override
public
void
eventAggTitleCache
()
{
AtomicInteger
total
=
new
AtomicInteger
();
List
<
Long
[]>
timeList
=
Arrays
.
asList
(
commonService
.
getTimeRangeDay
(),
commonService
.
getTimeRangeFormatWeek
(),
commonService
.
getTimeRangeFormatMonth
());
CompletableFuture
.
allOf
(
GlobalPojo
.
PROJECT_MAP
.
values
().
stream
().
map
(
project
->
CompletableFuture
.
supplyAsync
(()
->
{
UserThreadLocal
.
set
(
new
UserInfo
().
setProjectId
(
project
.
getId
()));
timeList
.
forEach
(
times
->
{
// 事件标题聚合缓存
eventService
.
getEventAggTitleList
(
times
[
0
],
times
[
1
],
false
);
});
log
.
info
(
"项目:{}-事件标题聚合缓存已完成:{}个"
,
project
.
getProjectName
(),
total
.
incrementAndGet
());
return
null
;
},
cacheServiceExecutor
)).
toArray
(
CompletableFuture
[]::
new
)).
join
();
}
private
Pair
<
List
<
Channel
>,
List
<
Channel
>>
batchHandle
(
List
<
Map
.
Entry
<
ChannelIndex
,
ChannelIndex
.
Record
>>
batchList
,
Map
<
ChannelIndex
,
private
Pair
<
List
<
Channel
>,
List
<
Channel
>>
batchHandle
(
List
<
Map
.
Entry
<
ChannelIndex
,
ChannelIndex
.
Record
>>
batchList
,
Map
<
ChannelIndex
,
ChannelIndex
.
Record
>
newRecordMap
)
{
ChannelIndex
.
Record
>
newRecordMap
)
{
List
<
Channel
>
insertList
=
Collections
.
synchronizedList
(
new
ArrayList
<>());
List
<
Channel
>
insertList
=
Collections
.
synchronizedList
(
new
ArrayList
<>());
...
...
src/main/java/com/zhiwei/brandkbs2/task/ControlCenter.java
View file @
f5708c01
...
@@ -44,7 +44,8 @@ public class ControlCenter {
...
@@ -44,7 +44,8 @@ public class ControlCenter {
log
.
info
(
"定时按天缓存数据-启动"
);
log
.
info
(
"定时按天缓存数据-启动"
);
try
{
try
{
taskService
.
messageFlowCache
();
taskService
.
messageFlowCache
();
taskService
.
customEventCache
();
// taskService.customEventCache();
taskService
.
eventAggTitleCache
();
taskService
.
yuqingAnalyzeHighWordCache
();
taskService
.
yuqingAnalyzeHighWordCache
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"定时按天缓存数据-出错"
,
e
);
log
.
error
(
"定时按天缓存数据-出错"
,
e
);
...
...
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
View file @
f5708c01
...
@@ -27,6 +27,10 @@ public class RedisUtil {
...
@@ -27,6 +27,10 @@ public class RedisUtil {
return
RedisKeyPrefix
.
CUSTOM_EVENT_LIST
+
Tools
.
concat
(
projectId
,
startTimeStr
,
endTimeStr
);
return
RedisKeyPrefix
.
CUSTOM_EVENT_LIST
+
Tools
.
concat
(
projectId
,
startTimeStr
,
endTimeStr
);
}
}
public
static
String
getEventAggTitleListKEY
(
String
projectId
,
Long
startTimeStr
,
Long
endTimeStr
)
{
return
RedisKeyPrefix
.
EVENT_AGG_TITLE_LIST
+
Tools
.
concat
(
projectId
,
startTimeStr
,
endTimeStr
);
}
public
static
String
getShotPageKey
(
String
id
,
String
projectId
)
{
public
static
String
getShotPageKey
(
String
id
,
String
projectId
)
{
return
RedisKeyPrefix
.
REDIS_SYSTEM_COPY
+
"SHOT_PAGE:"
+
projectId
+
"-"
+
id
;
return
RedisKeyPrefix
.
REDIS_SYSTEM_COPY
+
"SHOT_PAGE:"
+
projectId
+
"-"
+
id
;
}
}
...
...
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