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
ae7cf13b
Commit
ae7cf13b
authored
Jun 21, 2023
by
shentao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
Feature See merge request
!344
parents
17cb1c34
87f255d7
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
954 additions
and
273 deletions
+954
-273
pom.xml
+7
-1
src/main/java/com/zhiwei/brandkbs2/common/ChannelType.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
+28
-3
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
+1
-0
src/main/java/com/zhiwei/brandkbs2/controller/admin/BaseModuleController.java
+52
-8
src/main/java/com/zhiwei/brandkbs2/controller/admin/UserController.java
+5
-10
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+211
-19
src/main/java/com/zhiwei/brandkbs2/controller/app/AppWarnController.java
+87
-31
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/dao/HighlightWordDao.java
+12
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/BaseMongoDaoImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/dao/impl/HighlightWordDaoImpl.java
+20
-0
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportWordDTO.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/enmus/HotPlatformEnum.java
+57
-0
src/main/java/com/zhiwei/brandkbs2/pojo/AbstractBaseWord.java
+53
-0
src/main/java/com/zhiwei/brandkbs2/pojo/HighWord.java
+1
-40
src/main/java/com/zhiwei/brandkbs2/pojo/HighlightWord.java
+17
-0
src/main/java/com/zhiwei/brandkbs2/pojo/Project.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/pojo/User.java
+30
-2
src/main/java/com/zhiwei/brandkbs2/pojo/vo/SupplementWord.java
+41
-0
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/service/HighWordService.java
+3
-39
src/main/java/com/zhiwei/brandkbs2/service/HighlightWordService.java
+10
-0
src/main/java/com/zhiwei/brandkbs2/service/ProjectService.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/service/TableWordService.java
+49
-0
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
+2
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
+7
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/HighWordServiceImpl.java
+4
-54
src/main/java/com/zhiwei/brandkbs2/service/impl/HighlightWordServiceImpl.java
+21
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+8
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
+35
-3
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
+12
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/TableWordServiceImpl.java
+76
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+29
-33
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
+27
-6
src/main/resources/application-dev.properties
+4
-2
src/main/resources/application-local.properties
+5
-2
src/main/resources/application-prod.properties
+4
-2
src/test/java/com/zhiwei/brandkbs2/HighWordServiceTest.java
+5
-5
No files found.
pom.xml
View file @
ae7cf13b
...
...
@@ -25,7 +25,7 @@
<java.version>
1.8
</java.version>
<springboot.version>
2.2.5.RELEASE
</springboot.version>
<qbjc.bean.version>
1.1.7.1-SNAPSHOT
</qbjc.bean.version>
<springfox.version>
2.
7.0
</springfox.version>
<springfox.version>
2.
9.2
</springfox.version>
<fastjson.version>
1.2.47
</fastjson.version>
<easyexcel.version>
3.0.5
</easyexcel.version>
<marker.client.version>
1.1.9-SNAPSHOT
</marker.client.version>
...
...
@@ -40,6 +40,12 @@
</properties>
<dependencies>
<!-- 自动化中间件客户端 -->
<dependency>
<groupId>
com.zhiwei.middleware
</groupId>
<artifactId>
automaticmark-client
</artifactId>
<version>
2.3.1.1-SNAPSHOT
</version>
</dependency>
<!-- 去重 -->
<dependency>
<groupId>
com.zhiwei.middleware
</groupId>
...
...
src/main/java/com/zhiwei/brandkbs2/common/ChannelType.java
View file @
ae7cf13b
...
...
@@ -16,7 +16,7 @@ public class ChannelType {
private
static
final
List
<
String
>
MAIN_BODY_TYPES
=
Arrays
.
asList
(
"媒体"
,
"团体"
,
"普通用户"
,
"企业"
,
"名人"
,
"政务机构"
);
public
static
final
List
<
String
>
POLITICS_LEVELS
=
Arrays
.
asList
(
"央级"
,
"省级"
,
"地级"
);
private
static
final
List
<
String
>
FIELDS
=
Arrays
.
asList
(
"
情感"
,
"综合"
,
"财经"
,
"家居"
,
"社会"
,
"时尚"
,
"文化"
,
"历史"
,
"母婴育儿"
,
"体育"
,
"娱乐"
,
"动漫"
,
"汽车"
,
"美食"
,
"健康养生"
,
"国际"
,
"音乐"
,
"游戏"
,
"科技"
,
"旅游"
,
"军事"
,
"时事"
,
"教育
"
);
private
static
final
List
<
String
>
FIELDS
=
Arrays
.
asList
(
"
时政"
,
"财经"
,
"科技"
,
"社会民生"
,
"交通"
,
"综合"
,
"娱乐"
,
"生活"
,
"体育"
,
"教育"
,
"文化"
,
"母婴育儿"
,
"健康
"
);
private
static
final
JSONArray
REGION
=
GlobalPojo
.
CHINA_AREA_TAGS
;
public
static
JSONObject
channelOption
=
new
JSONObject
();
public
static
final
List
<
String
>
COMMON_FIELDS
=
Arrays
.
asList
(
"财经"
,
"科技"
,
"时政"
,
"社会民生"
,
"交通"
);
...
...
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
View file @
ae7cf13b
...
...
@@ -3,14 +3,19 @@ package com.zhiwei.brandkbs2.common;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.ChannelTag
;
import
com.zhiwei.brandkbs2.pojo.HighlightWord
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.automaticmark.graphs.Graphs
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
...
...
@@ -18,9 +23,7 @@ import org.springframework.stereotype.Component;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -40,6 +43,9 @@ public class GlobalPojo {
@Resource
(
name
=
"systemInfoServiceImpl"
)
private
SystemInfoService
systemInfoService
;
@Resource
(
name
=
"highlightWordDao"
)
private
HighlightWordDao
highlightWordDao
;
/**
* 监测系统平台
**/
...
...
@@ -72,6 +78,10 @@ public class GlobalPojo {
public
static
JSONArray
CHINA_AREA_TAGS
;
public
static
Map
<
String
,
List
<
String
>>
HIGHLIGHT_MAP
=
new
HashMap
<>();
public
static
Map
<
String
,
Graphs
>
PROJECT_GRAPHS
=
new
HashMap
<>();
public
static
final
List
<
String
>
PERMANENT_PLATFORM_NAMES
=
Arrays
.
asList
(
"网媒"
,
"微博"
,
"微信"
,
"今日头条"
);
public
static
final
String
ELSE_PLATFORM_NAME
=
"其他自媒体"
;
...
...
@@ -109,6 +119,7 @@ public class GlobalPojo {
MEDIA_TYPE
=
systemInfoService
.
getMediaTypes
();
PROJECT_MAP
=
systemInfoService
.
getProjects
();
YU_QING_PROJECTS
=
systemInfoService
.
getYuQingProjects
();
updateHighlightGraphs
();
log
.
info
(
"{}-获取PLATFORMS-size:{},TAGS-size:{},LINKED_GROUP_ID_TAGS:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{},YUQING-PROJECTS-size:{}"
,
logMsg
,
PLATFORMS
.
size
(),
TAGS
.
size
(),
LINKED_GROUP_ID_TAGS
.
size
(),
CHANNEL_TAGS
.
size
(),
MEDIA_TYPE
.
size
(),
PROJECT_MAP
.
size
(),
YU_QING_PROJECTS
.
size
());
}
catch
(
Exception
e
)
{
...
...
@@ -116,6 +127,20 @@ public class GlobalPojo {
}
}
private
void
updateHighlightGraphs
()
{
PROJECT_MAP
.
forEach
((
key
,
project
)
->
{
String
id
=
project
.
getId
();
List
<
String
>
list
=
highlightWordDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
id
))).
stream
().
map
(
HighlightWord:
:
getKeyword
).
collect
(
Collectors
.
toList
());
List
<
String
>
keywords
=
new
ArrayList
<>();
// 拆分关键词中的且逻辑
list
.
forEach
(
word
->
keywords
.
addAll
(
Arrays
.
asList
(
word
.
trim
().
split
(
" +"
))));
Graphs
graphs
=
new
Graphs
();
graphs
.
addGraph
(
keywords
);
HIGHLIGHT_MAP
.
put
(
id
,
list
);
PROJECT_GRAPHS
.
put
(
id
,
graphs
);
});
}
public
static
String
getPlatformIdByName
(
String
platformName
)
{
for
(
MessagePlatform
platform
:
PLATFORMS
)
{
if
(
platform
.
getName
().
equals
(
platformName
))
{
...
...
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
ae7cf13b
...
...
@@ -63,6 +63,7 @@ public class RedisKeyPrefix {
public
static
final
String
HOT_RANK_LIST
=
"BRANDKBS:HOT:RANK_LIST:"
;
public
static
final
String
HOT_LIST
=
"BRANDKBS:HOT:LIST:"
;
public
static
final
String
HOT_KEYWORD
=
"BRANDKBS:HOT:KEYWORD:"
;
public
static
final
String
HOT_SUPPLEMENT_WORD
=
"BRANDKBS:HOT:SUPPLEMENT_WORD:"
;
/**
* 项目简报报相关缓存KEY
...
...
@@ -125,6 +126,10 @@ public class RedisKeyPrefix {
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
HOT_KEYWORD
,
projectId
);
}
public
static
String
supplementWordKey
(
String
projectId
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
HOT_SUPPLEMENT_WORD
,
projectId
);
}
private
static
String
generateRedisKey
(
String
...
keys
)
{
Objects
.
requireNonNull
(
keys
);
boolean
contains
=
keys
[
0
].
endsWith
(
":"
);
...
...
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
View file @
ae7cf13b
...
...
@@ -16,6 +16,7 @@ public class Constant {
public
static
final
Long
ONE_DAY
=
24
*
60
*
60
*
1000L
;
public
static
final
Long
ONE_WEEK
=
7
*
24
*
60
*
60
*
1000L
;
public
static
final
Long
ONE_MONTH
=
30
*
24
*
60
*
60
*
1000L
;
public
static
final
Long
ONE_YEAR
=
ONE_MONTH
*
12
;
public
static
final
String
SPEC_MINUTE_PATTERN
=
"yyyy.MM.dd HH:mm"
;
public
static
final
String
HOUR_PATTERN
=
"yyyy-MM-dd HH"
;
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/BaseModuleController.java
View file @
ae7cf13b
...
...
@@ -5,12 +5,13 @@ import com.zhiwei.brandkbs2.auth.Auth;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.dto.Export
High
WordDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportWordDTO
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.HighWordService
;
import
com.zhiwei.brandkbs2.service.HighlightWordService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.TagFilterService
;
import
com.zhiwei.brandkbs2.util.Tools
;
...
...
@@ -42,6 +43,9 @@ public class BaseModuleController extends BaseController {
@Resource
(
name
=
"highWordServiceImpl"
)
HighWordService
highWordService
;
@Resource
(
name
=
"highlightWordServiceImpl"
)
HighlightWordService
highlightWordService
;
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
...
...
@@ -68,7 +72,7 @@ public class BaseModuleController extends BaseController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/highWord/list"
)
public
ResponseResult
findHighWordList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
highWordService
.
find
High
Word
(
page
,
size
,
keyword
));
return
ResponseResult
.
success
(
highWordService
.
findWord
(
page
,
size
,
keyword
));
}
@ApiOperation
(
"添加高频关键词列表"
)
...
...
@@ -76,14 +80,13 @@ public class BaseModuleController extends BaseController {
@PostMapping
(
"/highWord/add"
)
public
ResponseResult
addHighWordList
(
@RequestBody
JSONObject
info
)
{
List
<
String
>
highWords
=
info
.
getJSONArray
(
"list"
).
toJavaList
(
String
.
class
);
highWordService
.
addHighWordList
(
highWords
);
return
ResponseResult
.
success
();
return
highWordService
.
addWordList
(
highWords
,
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getNickname
());
}
@ApiOperation
(
"高频关键词删除"
)
@DeleteMapping
(
value
=
"/highWord/delete/{id}"
)
public
ResponseResult
deleteHighWord
(
@PathVariable
String
id
)
{
highWordService
.
delete
High
Word
(
id
);
highWordService
.
deleteWord
(
id
);
return
ResponseResult
.
success
();
}
...
...
@@ -96,9 +99,50 @@ public class BaseModuleController extends BaseController {
@ApiOperation
(
"高频关键词下载"
)
@GetMapping
(
value
=
"/highWord/download"
)
public
ResponseResult
downloadHighWord
()
{
List
<
ExportHighWordDTO
>
list
=
highWordService
.
downloadHighWord
();
ProjectVO
projectVO
=
projectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
());
EasyExcelUtil
.
download
(
projectVO
.
getBrandName
()
+
"_高频关键词"
,
"sheet1"
,
ExportHighWordDTO
.
class
,
list
,
response
);
String
projectId
=
UserThreadLocal
.
getProjectId
();
List
<
ExportWordDTO
>
list
=
highWordService
.
downloadWord
(
projectId
);
ProjectVO
projectVO
=
projectService
.
getProjectVOById
(
projectId
);
EasyExcelUtil
.
download
(
projectVO
.
getBrandName
()
+
"_高频关键词"
,
"sheet1"
,
ExportWordDTO
.
class
,
list
,
response
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"获取舆情列表高亮关键词"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/highlightWord/list"
)
public
ResponseResult
findHighlightKeywordList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
highlightWordService
.
findWord
(
page
,
pageSize
,
keyword
));
}
@ApiOperation
(
"添加舆情列表高亮关键词列表"
)
@ApiImplicitParams
(
@ApiImplicitParam
(
name
=
"list"
,
value
=
"高亮关键词列表"
,
paramType
=
"body"
,
dataType
=
"list"
))
@PostMapping
(
"/highlightWord/add"
)
public
ResponseResult
addHighlightWordList
(
@RequestBody
JSONObject
info
)
{
List
<
String
>
highWords
=
info
.
getJSONArray
(
"list"
).
toJavaList
(
String
.
class
);
return
highlightWordService
.
addWordList
(
highWords
,
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getNickname
());
}
@ApiOperation
(
"舆情列表高亮关键词删除"
)
@DeleteMapping
(
value
=
"/highlightWord/delete/{id}"
)
public
ResponseResult
deleteHighlightWord
(
@PathVariable
String
id
)
{
highlightWordService
.
deleteWord
(
id
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"舆情列表高亮关键词excel解析"
)
@PostMapping
(
value
=
"/highlightWord/excel/parse"
,
headers
=
"content-type=multipart/form-data"
)
public
ResponseResult
parseExcelHighlightWord
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
return
Tools
.
parseExcelInfo
(
file
);
}
@ApiOperation
(
"舆情列表高亮关键词下载"
)
@GetMapping
(
value
=
"/highlightWord/download"
)
public
ResponseResult
downloadHighlightWord
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
List
<
ExportWordDTO
>
list
=
highlightWordService
.
downloadWord
(
projectId
);
ProjectVO
projectVO
=
projectService
.
getProjectVOById
(
projectId
);
EasyExcelUtil
.
download
(
projectVO
.
getBrandName
()
+
"_舆情列表高亮关键词"
,
"sheet1"
,
ExportWordDTO
.
class
,
list
,
response
);
return
ResponseResult
.
success
();
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/UserController.java
View file @
ae7cf13b
...
...
@@ -4,9 +4,7 @@ import com.zhiwei.brandkbs2.auth.Auth;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
io.swagger.annotations.Api
;
...
...
@@ -33,11 +31,6 @@ public class UserController extends BaseController {
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
private
BehaviorService
behaviorService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"用户管理"
,
true
);
@Autowired
private
com
.
zhiwei
.
middleware
.
auth
.
core
.
UserInfoClient
userInfoClient
;
...
...
@@ -47,15 +40,17 @@ public class UserController extends BaseController {
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"搜索项目ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"role"
,
value
=
"角色类型"
,
required
=
false
,
defaultValue
=
"-1"
,
paramType
=
"query"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"role"
,
value
=
"角色类型"
,
required
=
false
,
defaultValue
=
"-1"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"sorter"
,
defaultValue
=
"{\"cTime\":\"descend\"}"
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/list"
)
public
ResponseResult
findList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"pid"
)
String
pid
,
@RequestParam
(
value
=
"role"
,
defaultValue
=
"-1"
)
int
role
)
{
return
ResponseResult
.
success
(
userService
.
findUserList
(
page
,
size
,
keyword
,
pid
,
role
));
@RequestParam
(
value
=
"role"
,
defaultValue
=
"-1"
)
int
role
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"cTime\":\"descend\"}"
)
String
sorter
)
{
return
ResponseResult
.
success
(
userService
.
findUserList
(
page
,
size
,
keyword
,
pid
,
role
,
sorter
));
}
@ApiOperation
(
"根据手机号搜索用户信息"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
ae7cf13b
...
...
@@ -9,14 +9,17 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.HotPlatformEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.vo.SupplementWord
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
io.swagger.annotations.
Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.
*
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -64,12 +67,23 @@ public class AppHotController extends BaseController {
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
@Resource
(
name
=
"commonServiceImpl"
)
CommonService
commonService
;
@Resource
(
name
=
"esSearchExecutor"
)
ThreadPoolTaskExecutor
executor
;
@Value
(
"${trends.getHotSearchFromEsInTimeAndTypeOrWord.url}"
)
private
String
hotSearchUrl
;
@Value
(
"${trends.queryHotSearchTrendInner.url}"
)
private
String
hotSearchTrendUrl
;
@Value
(
"${trends.getHotSearchSnapshot.url}"
)
private
String
hotSearchSnapshotUrl
;
private
final
String
allPlatform
=
"brandkbs-all"
;
/**
* weibo 热搜
* weibo-topic 话题
...
...
@@ -87,32 +101,28 @@ public class AppHotController extends BaseController {
@RequestParam
(
value
=
"sort"
,
defaultValue
=
"endTime"
)
String
sort
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
String
keywordStr
=
redisUtil
.
get
(
RedisKeyPrefix
.
hotKeywordKey
(
UserThreadLocal
.
getProjectId
()));
if
(
null
==
keywordStr
)
{
return
ResponseResult
.
success
();
}
String
keyword
=
StringUtils
.
join
(
JSONArray
.
parseArray
(
keywordStr
,
String
.
class
),
"|"
);
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
;
if
(
null
!=
startTime
&&
null
!=
endTime
)
{
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchUrl
+
"&startTime={6}&endTime={7}"
,
JSONObject
.
class
,
pageSize
,
page
,
type
,
keyword
,
sort
,
startTime
,
endTime
);
}
else
{
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchUrl
,
JSONObject
.
class
,
pageSize
,
page
,
type
,
keyword
,
sort
);
}
JSONObject
result
=
jsonObjectResponseEntity
.
getBody
();
JSONObject
result
=
searchHotHandler
(
pageSize
,
page
,
type
,
sort
,
startTime
,
endTime
);
if
(
Objects
.
isNull
(
result
))
{
return
ResponseResult
.
failure
(
"响应超时"
);
return
ResponseResult
.
success
(
);
}
// 查询在榜数据
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
getForEntity
(
trendsListUrl
,
JSONObject
.
class
,
null
,
type
,
null
);
if
(
Objects
.
isNull
(
responseEntity
.
getBody
()))
{
return
ResponseResult
.
success
(
result
);
List
<
String
>
rankingIds
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
responseEntity
.
getBody
()))
{
rankingIds
=
responseEntity
.
getBody
().
getJSONArray
(
"data"
).
stream
().
map
(
obj
->
((
JSONObject
)
obj
).
getString
(
"_id"
)).
collect
(
Collectors
.
toList
());
}
List
<
String
>
rankingIds
=
responseEntity
.
getBody
().
getJSONArray
(
"data"
).
stream
().
map
(
obj
->
((
JSONObject
)
obj
).
getString
(
"_id"
)).
collect
(
Collectors
.
toList
());
List
<
String
>
finalRankingIds
=
rankingIds
;
// 对比补录词
List
<
Object
>
valueList
=
redisUtil
.
getMapValueAll
(
RedisKeyPrefix
.
supplementWordKey
(
UserThreadLocal
.
getProjectId
()));
List
<
String
>
supplementList
=
valueList
.
stream
().
map
(
word
->
JSON
.
parseObject
((
String
)
word
,
SupplementWord
.
class
).
getTitle
()).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
list
=
result
.
getJSONArray
(
"data"
).
stream
().
map
(
obj
->
{
JSONObject
json
=
(
JSONObject
)
obj
;
if
(
r
ankingIds
.
contains
(
json
.
getString
(
"id"
)))
{
if
(
finalR
ankingIds
.
contains
(
json
.
getString
(
"id"
)))
{
json
.
put
(
"inTheList"
,
true
);
}
if
(
supplementList
.
contains
(
json
.
getString
(
"name"
)))
{
json
.
put
(
"supplement"
,
true
);
}
return
json
;
}).
collect
(
Collectors
.
toList
());
result
.
put
(
"data"
,
list
);
...
...
@@ -187,6 +197,136 @@ public class AppHotController extends BaseController {
}
}
@ApiOperation
(
"热点库-根据热搜平台和标题匹配查询条件"
)
@GetMapping
(
"/match-criteria"
)
public
ResponseResult
matchSearchCriteria
(
@RequestParam
String
name
,
@RequestParam
String
type
)
{
Long
[]
timeRangeMonth
=
commonService
.
getTimeRangeMonth
();
int
defaultPageSize
=
5
;
JSONObject
result
=
searchHotHandler
(
10000
,
1
,
HotPlatformEnum
.
convertFromName2Eng
(
type
),
"endTime"
,
timeRangeMonth
[
0
],
timeRangeMonth
[
1
]);
int
index
=
0
;
boolean
matched
=
false
;
List
<
JSONObject
>
data
=
result
.
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
);
for
(
JSONObject
json
:
data
)
{
index
++;
if
(
name
.
equals
(
json
.
getString
(
"name"
)))
{
matched
=
true
;
break
;
}
}
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"matched"
,
matched
);
if
(
matched
)
{
res
.
put
(
"page"
,
(
index
+
defaultPageSize
-
1
)
/
defaultPageSize
);
res
.
put
(
"type"
,
HotPlatformEnum
.
convertFromName2Eng
(
type
));
}
return
ResponseResult
.
success
(
res
);
}
@ApiOperation
(
"热点库-品牌热点-补录获取"
)
@GetMapping
(
"/supplementWord/get"
)
public
ResponseResult
getSupplementWord
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
key
=
RedisKeyPrefix
.
supplementWordKey
(
projectId
);
List
<
Object
>
valueList
=
redisUtil
.
getMapValueAll
(
key
);
List
<
SupplementWord
>
collect
=
valueList
.
stream
().
map
(
word
->
JSON
.
parseObject
((
String
)
word
,
SupplementWord
.
class
)).
sorted
((
x
,
y
)
->
Long
.
compare
(
y
.
getUpdateTime
(),
x
.
getUpdateTime
())).
collect
(
Collectors
.
toList
());
return
ResponseResult
.
success
(
collect
);
}
@ApiOperation
(
"热点库-品牌热点-补录新增"
)
@PostMapping
(
"/supplementWord/add"
)
public
ResponseResult
addSupplementWord
(
@ApiParam
(
name
=
"json:{title:标题}"
)
@RequestBody
JSONObject
json
)
{
String
key
=
RedisKeyPrefix
.
supplementWordKey
(
UserThreadLocal
.
getProjectId
());
if
(
redisUtil
.
getMapSize
(
key
)
>=
50
)
{
return
ResponseResult
.
failure
(
"补录超过预设上限"
);
}
String
title
=
json
.
getString
(
"title"
);
if
(
StringUtils
.
isEmpty
(
title
))
{
return
ResponseResult
.
failure
(
"补录新增失败"
);
}
SupplementWord
supplementWord
=
new
SupplementWord
(
title
,
UserThreadLocal
.
getNickname
());
boolean
result
=
redisUtil
.
setMapValue
(
key
,
supplementWord
.
uniqueKey
(),
JSON
.
toJSONString
(
supplementWord
));
if
(!
result
)
{
return
ResponseResult
.
failure
(
"补录新增失败"
);
}
return
ResponseResult
.
success
();
}
@ApiOperation
(
"热点库-品牌热点-补录修改"
)
@PutMapping
(
"/supplementWord/update"
)
public
ResponseResult
updateSupplementWord
(
@ApiParam
(
name
=
"json:{title:原标题,newTitle:新标题,updateTime:更新时间}"
)
@RequestBody
JSONObject
json
)
{
String
newTitle
=
json
.
getString
(
"newTitle"
);
String
title
=
json
.
getString
(
"title"
);
Long
updateTime
=
json
.
getLong
(
"updateTime"
);
SupplementWord
supplementWord
=
new
SupplementWord
(
newTitle
,
UserThreadLocal
.
getNickname
());
boolean
result
=
redisUtil
.
resetMapValue
(
RedisKeyPrefix
.
supplementWordKey
(
UserThreadLocal
.
getProjectId
()),
title
+
updateTime
,
supplementWord
.
uniqueKey
(),
JSON
.
toJSONString
(
supplementWord
));
if
(!
result
)
{
return
ResponseResult
.
failure
(
"补录修改失败"
);
}
return
ResponseResult
.
success
();
}
@ApiOperation
(
"热点库-品牌热点-补录删除"
)
@DeleteMapping
(
"/supplementWord/delete"
)
public
ResponseResult
deleteSupplementWord
(
@ApiParam
(
name
=
"json:{title:原标题,updateTime:更新时间}"
)
@RequestBody
JSONObject
json
)
{
String
title
=
json
.
getString
(
"title"
);
Long
updateTime
=
json
.
getLong
(
"updateTime"
);
redisUtil
.
deleteMapValue
(
RedisKeyPrefix
.
supplementWordKey
(
UserThreadLocal
.
getProjectId
()),
title
+
updateTime
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"热点库-品牌热点-热点总览"
)
@GetMapping
(
"/overview"
)
public
ResponseResult
hotOverview
()
{
Long
[]
timeMonth
=
commonService
.
getTimeRangeFormatMonth
();
JSONObject
result
=
searchHotHandler
(
10000
,
1
,
allPlatform
,
"endTime"
,
timeMonth
[
0
],
timeMonth
[
1
]);
if
(
Objects
.
isNull
(
result
))
{
return
ResponseResult
.
success
();
}
List
<
JSONObject
>
list
=
result
.
getJSONArray
(
"data"
).
stream
().
map
(
obj
->
{
JSONObject
json
=
(
JSONObject
)
obj
;
json
.
put
(
"platform"
,
HotPlatformEnum
.
convertPlatform
(
json
.
getString
(
"type"
)));
return
json
;
}).
collect
(
Collectors
.
toList
());
result
.
put
(
"data"
,
list
);
return
ResponseResult
.
success
(
result
);
}
@ApiOperation
(
"热点库-品牌热点-热搜对比"
)
@GetMapping
(
"/contrast"
)
public
ResponseResult
hotContrast
()
{
// 默认返回近一年的数据
JSONObject
result
=
searchHotHandler
(
10000
,
1
,
allPlatform
,
"endTime"
,
null
,
null
);
if
(
Objects
.
isNull
(
result
))
{
return
ResponseResult
.
success
();
}
JSONObject
data
=
new
JSONObject
();
List
<
JSONObject
>
list
=
result
.
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
);
// 近一周的数据统计
data
.
put
(
"weekContrast"
,
contrastReport
(
list
,
commonService
.
getTimeRangeFormatWeek
(),
Constant
.
ONE_WEEK
));
data
.
put
(
"monthContrast"
,
contrastReport
(
list
,
commonService
.
getTimeRangeFormatMonth
(),
Constant
.
ONE_MONTH
));
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"热点库-品牌热点-热搜趋势"
)
@GetMapping
(
"/trend"
)
public
ResponseResult
hotSearchTrend
(
@RequestParam
String
name
,
@RequestParam
Long
startTime
,
@RequestParam
String
type
)
{
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchTrendUrl
,
JSONObject
.
class
,
name
,
startTime
,
HotPlatformEnum
.
convertFromName2Eng
(
type
));
if
(
Objects
.
isNull
(
jsonObjectResponseEntity
.
getBody
()))
{
return
ResponseResult
.
failure
(
"查询热搜趋势失败"
);
}
return
ResponseResult
.
success
(
jsonObjectResponseEntity
.
getBody
());
}
@ApiOperation
(
"热点库-品牌热点-上榜/峰值截图"
)
@GetMapping
(
"/snapshot"
)
public
ResponseResult
hotSnapshot
(
@RequestParam
String
type
,
@RequestParam
Long
time
,
@RequestParam
Integer
rank
)
{
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchSnapshotUrl
,
JSONObject
.
class
,
HotPlatformEnum
.
convertFromName2Eng
(
type
),
time
,
rank
);
if
(
Objects
.
isNull
(
jsonObjectResponseEntity
.
getBody
()))
{
return
ResponseResult
.
failure
(
"上榜/峰值截图失败"
);
}
return
ResponseResult
.
success
(
jsonObjectResponseEntity
.
getBody
());
}
@ApiOperation
(
"首页-近24小时热门舆情,查竞品-竞品动态"
)
@GetMapping
(
"/latestNews"
)
public
ResponseResult
latestNews
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"5"
)
Integer
size
,
...
...
@@ -217,4 +357,56 @@ public class AppHotController extends BaseController {
},
executor
)).
toArray
(
CompletableFuture
[]::
new
)).
join
();
return
ResponseResult
.
success
(
resultList
);
}
/**
* 通过热搜中间件获取数据
*
* @param pageSize
* @param page
* @param type
* @param sort
* @param startTime
* @param endTime
* @return
*/
private
JSONObject
searchHotHandler
(
int
pageSize
,
int
page
,
String
type
,
String
sort
,
Long
startTime
,
Long
endTime
)
{
String
keywordStr
=
redisUtil
.
get
(
RedisKeyPrefix
.
hotKeywordKey
(
UserThreadLocal
.
getProjectId
()));
if
(
null
==
keywordStr
)
{
return
null
;
}
String
accurateWord
=
null
;
List
<
Object
>
valueList
=
redisUtil
.
getMapValueAll
(
RedisKeyPrefix
.
supplementWordKey
(
UserThreadLocal
.
getProjectId
()));
if
(
CollectionUtils
.
isNotEmpty
(
valueList
))
{
List
<
String
>
collect
=
valueList
.
stream
().
map
(
word
->
JSON
.
parseObject
((
String
)
word
,
SupplementWord
.
class
).
getTitle
()).
collect
(
Collectors
.
toList
());
accurateWord
=
StringUtils
.
join
(
collect
,
"|"
);
}
String
keyword
=
StringUtils
.
join
(
JSONArray
.
parseArray
(
keywordStr
,
String
.
class
),
"|"
);
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
;
if
(
null
!=
startTime
&&
null
!=
endTime
)
{
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchUrl
+
"&startTime={7}&endTime={8}"
,
JSONObject
.
class
,
pageSize
,
page
,
type
,
keyword
,
sort
,
accurateWord
,
startTime
,
endTime
);
}
else
{
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchUrl
,
JSONObject
.
class
,
pageSize
,
page
,
type
,
keyword
,
sort
,
accurateWord
);
}
return
jsonObjectResponseEntity
.
getBody
();
}
private
JSONObject
contrastReport
(
List
<
JSONObject
>
source
,
Long
[]
timeRange
,
Long
space
)
{
JSONObject
result
=
new
JSONObject
();
List
<
JSONObject
>
list
=
source
.
stream
().
filter
(
json
->
json
.
getLong
(
"startTime"
)
>=
timeRange
[
0
]).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
lastList
=
source
.
stream
().
filter
(
json
->
json
.
getLong
(
"startTime"
)
>=
(
timeRange
[
0
]
-
space
)
&&
json
.
getLong
(
"startTime"
)
<
timeRange
[
0
]).
collect
(
Collectors
.
toList
());
result
.
put
(
"currentCount"
,
list
.
size
());
result
.
put
(
"lastCount"
,
list
.
size
()
-
lastList
.
size
());
Map
<
String
,
List
<
JSONObject
>>
platformMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
json
->
HotPlatformEnum
.
convertPlatform
(
json
.
getString
(
"type"
))));
List
<
JSONObject
>
platformCount
=
new
ArrayList
<>();
platformMap
.
forEach
((
platform
,
datas
)
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"platform"
,
platform
);
json
.
put
(
"count"
,
datas
.
size
());
platformCount
.
add
(
json
);
});
result
.
put
(
"platformCount"
,
platformCount
);
result
.
put
(
"averageCount"
,
source
.
size
()
/
(
Constant
.
ONE_YEAR
/
space
));
return
result
;
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppWarnController.java
View file @
ae7cf13b
...
...
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Map
;
...
...
@@ -92,33 +93,54 @@ public class AppWarnController extends BaseController {
@Value
(
"${warn.taskSwitch.url}"
)
private
String
warnTaskSwitchUrl
;
@ApiOperation
(
"情报预警-推送任务获取
/新增
"
)
@ApiOperation
(
"情报预警-推送任务获取"
)
@GetMapping
(
"/project"
)
public
ResponseResult
getPushTaskId
()
{
try
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectName
=
projectService
.
getProjectById
(
projectId
).
getProjectName
();
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
// header不支持中文 故对userName进行encode操作
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
projectId
).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
Object
>
request
=
new
HttpEntity
<>(
headers
);
return
pushTaskId
(
null
,
null
,
HttpMethod
.
GET
);
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-推送任务获取失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务获取失败"
);
}
}
JSONObject
data
=
restTemplate
.
exchange
(
warnProjectUrl
,
HttpMethod
.
GET
,
request
,
JSONObject
.
class
,
projectId
,
projectName
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-推送任务获取/新增失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务获取/新增失败"
);
@ApiOperation
(
"情报预警-推送任务新增"
)
@PostMapping
(
"/project"
)
public
ResponseResult
postPushTaskId
(
@RequestBody
JSONObject
json
)
{
try
{
return
pushTaskId
(
null
,
json
.
getString
(
"planName"
),
HttpMethod
.
POST
);
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-推送任务新增失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务新增失败"
);
}
}
@ApiOperation
(
"情报预警-推送任务修改"
)
@PutMapping
(
"/project"
)
public
ResponseResult
putPushTaskId
(
@RequestBody
JSONObject
json
)
{
try
{
return
pushTaskId
(
json
.
getString
(
"taskId"
),
json
.
getString
(
"planName"
),
HttpMethod
.
PUT
);
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-推送任务修改失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务修改失败"
);
}
}
@ApiOperation
(
"情报预警-推送任务删除"
)
@DeleteMapping
(
"/project"
)
@Auth
(
role
=
RoleEnum
.
ADMIN
)
public
ResponseResult
deletePushTaskId
(
@RequestParam
(
value
=
"taskId"
)
String
taskId
)
{
try
{
return
pushTaskId
(
taskId
,
null
,
HttpMethod
.
DELETE
);
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-推送任务删除失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务删除失败"
);
}
}
@ApiOperation
(
"情报预警-获取项目预警更新条件"
)
@GetMapping
(
"/warnCriteria"
)
public
ResponseResult
getProjectWarnCriteria
(
@RequestParam
(
value
=
"type"
)
String
type
){
public
ResponseResult
getProjectWarnCriteria
(
@RequestParam
(
value
=
"type"
)
String
type
)
{
return
ResponseResult
.
success
(
projectWarnService
.
getProjectWarnCriteria
(
UserThreadLocal
.
getProjectId
(),
type
));
}
...
...
@@ -136,7 +158,7 @@ public class AppWarnController extends BaseController {
@ApiOperation
(
"情报预警-已扫码推送名单获取"
)
@GetMapping
(
"/pushRecipientsList"
)
public
ResponseResult
pushRecipientList
(
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
){
public
ResponseResult
pushRecipientList
(
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
...
...
@@ -149,7 +171,7 @@ public class AppWarnController extends BaseController {
@ApiOperation
(
"情报预警-删除推送人"
)
@GetMapping
(
"/deletePushRecipients"
)
public
ResponseResult
deletePushRecipients
(
@RequestParam
(
value
=
"recipientsId"
)
String
recipientsId
,
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
){
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
...
...
@@ -163,7 +185,7 @@ public class AppWarnController extends BaseController {
@PutMapping
(
"/channel/{pushTaskId}"
)
public
ResponseResult
channel
(
@ApiParam
(
name
=
"channelConfig"
,
value
=
"情报预警-渠道参与配置-json:{\"channel\": \"string\", \"configName\": \"string\", \"duplicate\": true, \"friendlyChannel\": true, \"markerTags\": [\"string\"], \"primary\": [true], \"pushInterval\": 0, \"threshold\": 0, \"used\": true}"
,
required
=
true
)
@RequestBody
JSONObject
channelConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
...
...
@@ -178,9 +200,9 @@ public class AppWarnController extends BaseController {
JSONObject
data
=
restTemplate
.
exchange
(
warnChannelUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-渠道参与配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-渠道参与配置失败"
);
return
ResponseResult
.
failure
(
"情报预警-渠道参与配置失败"
);
}
}
...
...
@@ -188,7 +210,7 @@ public class AppWarnController extends BaseController {
@PutMapping
(
"/hotTop/{pushTaskId}"
)
public
ResponseResult
hotTop
(
@ApiParam
(
name
=
"hotTopConfig"
,
value
=
"情报预警-热点榜单配置-json:{\"configName\": \"string\", \"filterKeyword\": \"string\", \"firstTop\": true, \"introduction\": true,\"listType\": [\"string\"], \"newHeight\": true, \"pushInterval\": 0, \"topNewHeight\": 0, \"topOnceAgain\": true, \"used\": true, \"warnKeyword\": \"string\"}"
,
required
=
true
)
@RequestBody
JSONObject
hotTopConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
...
...
@@ -203,7 +225,7 @@ public class AppWarnController extends BaseController {
JSONObject
data
=
restTemplate
.
exchange
(
warnHotTopUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-热点榜单配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-热点榜单配置失败"
);
}
...
...
@@ -213,7 +235,7 @@ public class AppWarnController extends BaseController {
@PutMapping
(
"/hotEvent/{pushTaskId}"
)
public
ResponseResult
hotEvent
(
@ApiParam
(
name
=
"hotEventConfig"
,
value
=
"情报预警-热点事件配置-json:{\"configName\": \"string\", \"contendsEvent\": [\"string\"], \"eventTop\": 0, \"ownEvent\": [\"string\"], \"timeCycles\": 0,\"used\": true, \"zhiWeiEvent\": [\"string\"]}"
,
required
=
true
)
@RequestBody
JSONObject
hotEventConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
...
...
@@ -228,7 +250,7 @@ public class AppWarnController extends BaseController {
JSONObject
data
=
restTemplate
.
exchange
(
warnHotEventUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-热点事件配置失败- "
,
e
);
return
ResponseResult
.
failure
(
"情报预警-热点事件配置失败"
);
}
...
...
@@ -238,7 +260,7 @@ public class AppWarnController extends BaseController {
@PutMapping
(
"/yuQing/{pushTaskId}"
)
public
ResponseResult
yuQing
(
@ApiParam
(
name
=
"yuQingConfig"
,
value
=
"情报预警-舆情动态配置-json:{\"channelTypes\": [\"string\"], \"configName\": \"string\", \"contends\": [\"string\"], \"duplicate\": true, \"keyword\": \"string\", \"markerTags\": [\"string\"], \"primary\": [true], \"pushInterval\": 0, \"used\": true}"
,
required
=
true
)
@RequestBody
JSONObject
yuQingConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
...
...
@@ -253,7 +275,7 @@ public class AppWarnController extends BaseController {
JSONObject
data
=
restTemplate
.
exchange
(
warnYuQingUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-舆情动态配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-舆情动态配置失败"
);
}
...
...
@@ -262,7 +284,7 @@ public class AppWarnController extends BaseController {
@ApiOperation
(
"情报预警-任务开关"
)
@PutMapping
(
"/taskSwitch"
)
public
ResponseResult
taskSwitch
(
@ApiParam
(
name
=
"info"
,
value
=
"推送任务-开关-json:{id:, used:true|false, configType:HOT_EVENT}"
,
required
=
true
)
@RequestBody
JSONObject
info
){
@RequestBody
JSONObject
info
)
{
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
...
...
@@ -277,9 +299,43 @@ public class AppWarnController extends BaseController {
JSONObject
data
=
restTemplate
.
exchange
(
warnTaskSwitchUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"情报预警-任务开关失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-任务开关失败"
);
}
}
private
ResponseResult
pushTaskId
(
String
taskId
,
String
planName
,
HttpMethod
httpMethod
)
throws
UnsupportedEncodingException
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectName
=
projectService
.
getProjectById
(
projectId
).
getProjectName
();
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
// header不支持中文 故对userName进行encode操作
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
projectId
).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
Object
>
request
;
if
(
HttpMethod
.
GET
==
httpMethod
)
{
request
=
new
HttpEntity
<>(
headers
);
return
ResponseResult
.
success
(
restTemplate
.
exchange
(
warnProjectUrl
+
"?projectId={1}&projectName={2}"
,
httpMethod
,
request
,
JSONObject
.
class
,
projectId
,
projectName
).
getBody
().
getJSONArray
(
"data"
));
}
if
(
HttpMethod
.
DELETE
==
httpMethod
)
{
request
=
new
HttpEntity
<>(
headers
);
return
ResponseResult
.
success
(
restTemplate
.
exchange
(
warnProjectUrl
+
"/"
+
taskId
,
httpMethod
,
request
,
JSONObject
.
class
).
getBody
().
getJSONArray
(
"data"
));
}
JSONObject
paramMap
=
new
JSONObject
();
paramMap
.
put
(
"planName"
,
planName
);
if
(
HttpMethod
.
PUT
==
httpMethod
)
{
paramMap
.
put
(
"taskId"
,
taskId
);
}
else
{
paramMap
.
put
(
"projectId"
,
projectId
);
paramMap
.
put
(
"projectName"
,
projectName
);
}
request
=
new
HttpEntity
<>(
paramMap
,
headers
);
return
ResponseResult
.
success
(
restTemplate
.
exchange
(
warnProjectUrl
,
httpMethod
,
request
,
JSONObject
.
class
).
getBody
().
getJSONArray
(
"data"
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
View file @
ae7cf13b
...
...
@@ -76,12 +76,14 @@ public class MobileEventController extends BaseController {
@ApiOperation
(
"移动端事件详情-事件基础信息"
)
@GetMapping
(
"/detail/baseInfo"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventBaseInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventBaseInfo
(
eventId
));
}
@ApiOperation
(
"移动端事件详情-传播趋势图"
)
@GetMapping
(
"/detail/dissemination-trends"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventDisseminationTrends
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"小时"
)
String
type
){
return
ResponseResult
.
success
(
eventService
.
eventDisseminationTrends
(
eventId
,
type
));
...
...
@@ -89,6 +91,7 @@ public class MobileEventController extends BaseController {
@ApiOperation
(
"移动端事件详情-渠道发声"
)
@GetMapping
(
"/detail/channel-voices"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventChannelVoices
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"重要渠道"
)
String
type
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
...
...
@@ -100,6 +103,7 @@ public class MobileEventController extends BaseController {
@ApiOperation
(
"移动端事件详情-热门文章分析"
)
@GetMapping
(
"/detail/top-articles-analysis"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventTopArticlesAnalysis
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"按时间"
)
String
type
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"全部"
)
String
emotion
,
...
...
@@ -109,6 +113,7 @@ public class MobileEventController extends BaseController {
@ApiOperation
(
"移动端事件详情-热门渠道发声、上榜热搜、词云"
)
@GetMapping
(
"/detail/additional-info"
)
@Auth
(
role
=
RoleEnum
.
NO_AUTHORISE
)
public
ResponseResult
eventDetailAdditionalInfo
(
@RequestParam
(
value
=
"eventId"
)
String
eventId
){
return
ResponseResult
.
success
(
eventService
.
eventDetailAdditionalInfo
(
eventId
));
}
...
...
src/main/java/com/zhiwei/brandkbs2/dao/HighlightWordDao.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.HighlightWord
;
/**
* @ClassName: HighlightWordDao
* @Description HighlightWordDao
* @author: sjj
* @date: 2022-06-06 09:47
*/
public
interface
HighlightWordDao
extends
BaseMongoDao
<
HighlightWord
>{
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/BaseMongoDaoImpl.java
View file @
ae7cf13b
...
...
@@ -172,7 +172,7 @@ public class BaseMongoDaoImpl<T extends AbstractBaseMongo> implements BaseMongoD
return
;
}
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
JSONObject
.
parseObject
(
sorter
).
entrySet
())
{
if
(
entry
.
getValue
().
toString
().
contains
(
"desc"
))
{
if
(
null
!=
entry
.
getValue
()
&&
entry
.
getValue
().
toString
().
contains
(
"desc"
))
{
query
.
with
(
Sort
.
by
(
Sort
.
Order
.
desc
(
entry
.
getKey
())));
}
else
{
query
.
with
(
Sort
.
by
(
Sort
.
Order
.
asc
(
entry
.
getKey
())));
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/HighlightWordDaoImpl.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.pojo.HighlightWord
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName: HighlightWordDaoImpl
* @Description HighlightWordDaoImpl
* @author: sjj
* @date: 2022-06-06 09:48
*/
@Component
(
"highlightWordDao"
)
public
class
HighlightWordDaoImpl
extends
BaseMongoDaoImpl
<
HighlightWord
>
implements
HighlightWordDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_highlight_word"
;
public
HighlightWordDaoImpl
()
{
super
(
COLLECTION_NAME
);
}
}
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/Export
High
WordDTO.java
→
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportWordDTO.java
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
easyexcel
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.zhiwei.brandkbs2.pojo.
High
Word
;
import
com.zhiwei.brandkbs2.pojo.
AbstractBase
Word
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
lombok.Data
;
import
lombok.ToString
;
...
...
@@ -16,7 +16,7 @@ import java.util.Date;
*/
@Data
@ToString
public
class
Export
High
WordDTO
{
public
class
ExportWordDTO
{
/**
* 名称
...
...
@@ -36,8 +36,8 @@ public class ExportHighWordDTO {
@ExcelProperty
(
"上传人"
)
private
String
submitter
;
public
static
Export
HighWordDTO
createFromHighWord
(
HighWord
highWord
)
{
return
Tools
.
convertMap
(
highWord
,
ExportHigh
WordDTO
.
class
);
public
static
Export
WordDTO
createFromWord
(
AbstractBaseWord
word
)
{
return
Tools
.
convertMap
(
word
,
Export
WordDTO
.
class
);
}
}
src/main/java/com/zhiwei/brandkbs2/enmus/HotPlatformEnum.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
enmus
;
import
lombok.Getter
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @ClassName: HotPlatformEnum
* @Description 热搜中间件返回平台枚举
* @author: sjj
* @date: 2023-06-13 14:30
*/
@Getter
public
enum
HotPlatformEnum
{
WEIBO
(
"微博"
,
"weibo"
,
"微博热搜"
),
WEIBO_TOPIC
(
"微博"
,
"weibo-topic"
,
"微博话题"
),
WEIBO_RISE
(
"微博"
,
"weibo-rise"
,
"微博预热榜"
),
ZHIHU
(
"知乎"
,
"zhihu"
,
"知乎热搜"
),
JINRITOUTIAO
(
"今日头条"
,
"toutiao"
,
"今日头条热搜"
),
DOUYIN
(
"抖音"
,
"douyin"
,
"抖音热搜"
),
BILIBILI
(
"B站"
,
"bilibili-ranking"
,
"B站热搜"
),
KUAISHOU
(
"快手"
,
"kuaishou"
,
"快手热榜"
),
BAIDU
(
"百度"
,
"baidu"
,
"百度热搜"
);
private
final
String
platform
;
private
final
String
engName
;
private
final
String
name
;
private
static
final
Map
<
String
,
String
>
CONVERT_MAP
=
new
HashMap
<>();
static
{
for
(
HotPlatformEnum
platform
:
HotPlatformEnum
.
values
())
{
CONVERT_MAP
.
put
(
platform
.
name
,
platform
.
platform
);
}
}
HotPlatformEnum
(
String
platform
,
String
engName
,
String
name
)
{
this
.
platform
=
platform
;
this
.
engName
=
engName
;
this
.
name
=
name
;
}
public
static
String
convertPlatform
(
String
name
)
{
return
CONVERT_MAP
.
get
(
name
);
}
public
static
String
convertFromName2Eng
(
String
name
)
{
for
(
HotPlatformEnum
platform
:
HotPlatformEnum
.
values
())
{
if
(
name
.
equals
(
platform
.
name
))
{
return
platform
.
engName
;
}
}
return
name
;
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/AbstractBaseWord.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @ClassName: AbstractBaseWord
* @Description AbstractBaseWord
* @author: sjj
* @date: 2023-05-25 14:41
*/
@Setter
@Getter
public
abstract
class
AbstractBaseWord
extends
AbstractBaseMongo
{
/**
* 名称
*/
private
String
keyword
;
/**
* 创建时间
*/
private
Long
cTime
;
/**
* 上传人
*/
private
String
submitter
;
/**
* 项目ID
*/
private
String
projectId
;
public
static
<
T
>
List
<
T
>
createFromList
(
List
<
String
>
keywords
,
String
projectId
,
String
submitter
)
{
List
<
T
>
res
=
new
ArrayList
<>();
Long
now
=
System
.
currentTimeMillis
();
for
(
String
keyword
:
keywords
)
{
AbstractBaseWord
word
=
new
HighWord
();
word
.
setKeyword
(
keyword
);
word
.
setCTime
(
now
);
word
.
setProjectId
(
projectId
);
word
.
setSubmitter
(
submitter
);
res
.
add
((
T
)
word
);
}
return
res
;
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/HighWord.java
View file @
ae7cf13b
...
...
@@ -4,10 +4,6 @@ import lombok.Getter;
import
lombok.Setter
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @ClassName: HighWord
* @Description 高频词实体
...
...
@@ -17,40 +13,5 @@ import java.util.List;
@Getter
@Setter
@Document
(
collection
=
"brandkbs_high_word"
)
public
class
HighWord
extends
AbstractBaseMongo
{
/**
* 名称
*/
private
String
keyword
;
/**
* 创建时间
*/
private
Long
cTime
;
/**
* 上传人
*/
private
String
submitter
;
/**
* 项目ID
*/
private
String
projectId
;
public
static
List
<
HighWord
>
createFromList
(
List
<
String
>
keywords
,
String
projectId
,
String
submitter
)
{
List
<
HighWord
>
res
=
new
ArrayList
<>();
Long
now
=
new
Date
().
getTime
();
for
(
String
keyword
:
keywords
)
{
HighWord
highWord
=
new
HighWord
();
highWord
.
setKeyword
(
keyword
);
highWord
.
setCTime
(
now
);
highWord
.
setProjectId
(
projectId
);
highWord
.
setSubmitter
(
submitter
);
res
.
add
(
highWord
);
}
return
res
;
}
public
class
HighWord
extends
AbstractBaseWord
{
}
src/main/java/com/zhiwei/brandkbs2/pojo/HighlightWord.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* @ClassName: HighWord
* @Description 高频词实体
* @author: sjj
* @date: 2022-06-06 09:36
*/
@Getter
@Setter
@Document
(
collection
=
"brandkbs_highlight_word"
)
public
class
HighlightWord
extends
AbstractBaseWord
{
}
src/main/java/com/zhiwei/brandkbs2/pojo/Project.java
View file @
ae7cf13b
...
...
@@ -87,6 +87,11 @@ public class Project extends AbstractProject {
private
Long
uTime
;
/**
* 高亮关键词
*/
private
List
<
String
>
highlightKeyword
;
/**
* 项目主品牌配置信息转换
*
* @return 项目对象
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/User.java
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -70,15 +72,41 @@ public class User extends AbstractBaseMongo {
*/
private
String
subscriptionAccountOpenId
;
public
static
User
createFromCenterUser
(
CenterUser
centerUser
)
{
/**
* 操作人
*/
private
String
submitter
;
private
User
(){
}
public
static
User
createFromUserDTO
(
UserDTO
userDTO
,
String
submitter
)
{
User
user
=
new
User
();
user
.
setId
(
userDTO
.
getId
());
user
.
setNickname
(
userDTO
.
getNickname
());
user
.
setCTime
(
System
.
currentTimeMillis
());
user
.
setUsername
(
userDTO
.
getUsername
());
user
.
setPhoneNumber
(
userDTO
.
getPhoneNumber
());
if
(
RoleEnum
.
SUPER_ADMIN
.
getState
()
==
userDTO
.
getRoleId
())
{
user
.
setSuperAdmin
(
true
);
}
else
{
user
.
setRoles
(
Collections
.
singletonList
(
UserRole
.
createFromUserDto
(
userDTO
)));
user
.
setSuperAdmin
(
false
);
}
user
.
setSubmitter
(
submitter
);
return
user
;
}
public
static
User
createFromCenterUser
(
CenterUser
centerUser
,
String
submitter
)
{
User
user
=
new
User
();
user
.
setId
(
String
.
valueOf
(
centerUser
.
getId
()));
user
.
setNickname
(
centerUser
.
getNickName
());
user
.
setCTime
(
System
.
currentTimeMillis
());
user
.
setUsername
(
centerUser
.
getName
());
user
.
setPhoneNumber
(
Long
.
parseLong
(
centerUser
.
getPhone
()));
user
.
setAvatarUrl
(
centerUser
.
getAvatarUrl
());
user
.
setCTime
(
new
Date
().
getTime
());
user
.
setRoles
(
new
ArrayList
<>());
user
.
setSubmitter
(
submitter
);
return
user
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/vo/SupplementWord.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
vo
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @ClassName: SupplementWord
* @Description SupplementWord
* @author: sjj
* @date: 2023-06-12 17:42
*/
@Data
@NoArgsConstructor
public
class
SupplementWord
{
/**
* 补录标题
*/
private
String
title
;
/**
* 更新时间
*/
private
Long
updateTime
;
/**
* 提交人
*/
private
String
submitter
;
public
SupplementWord
(
String
title
,
String
submitter
)
{
this
.
title
=
title
;
this
.
submitter
=
submitter
;
this
.
updateTime
=
System
.
currentTimeMillis
();
}
public
String
uniqueKey
()
{
return
title
+
updateTime
;
}
}
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
View file @
ae7cf13b
...
...
@@ -59,6 +59,8 @@ public interface CommonService {
*/
void
addMtagBatch
(
List
<
MarkInfo
>
markInfos
);
Long
[]
getTimeRangeYear
();
Long
[]
getTimeRangeMonth
();
Long
[]
getTimeRangeWeek
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/HighWordService.java
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportHighWordDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
java.util.List
;
/**
* @ClassName: HighWordService
* @Description 高频词服务接口
* @author: sjj
* @date: 2022-06-06 09:59
*/
public
interface
HighWordService
{
/**
* 分页查询高频词列表
*
* @param page 页码
* @param size 页码大小
* @param keyword 关键词
* @return PageVO<JSONObject>
*/
PageVO
<
JSONObject
>
findHighWord
(
int
page
,
int
size
,
String
keyword
);
/**
* 添加高频关键词
*
* @param highWords 高频词
*/
void
addHighWordList
(
List
<
String
>
highWords
);
/**
* 删除高频关键词
*
* @param id 高频词id
*/
void
deleteHighWord
(
String
id
);
/**
* 下载高频关键词
*
* @return List<ExportHighWordDTO>
*/
List
<
ExportHighWordDTO
>
downloadHighWord
();
}
public
interface
HighWordService
extends
TableWordService
{
}
\ No newline at end of file
src/main/java/com/zhiwei/brandkbs2/service/HighlightWordService.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
;
/**
* @ClassName: HighlightWordService
* @Description HighlightWordService
* @author: sjj
* @date: 2023-05-25 15:10
*/
public
interface
HighlightWordService
extends
TableWordService
{
}
src/main/java/com/zhiwei/brandkbs2/service/ProjectService.java
View file @
ae7cf13b
...
...
@@ -133,4 +133,12 @@ public interface ProjectService {
* @return
*/
ResponseResult
getHitTagsByLinkedGroupId
(
String
linkedGroupId
);
/**
*
* @param projectId 项目id
* @return 高亮关键词
*/
List
<
String
>
getHighlightKeyword
(
String
projectId
);
}
src/main/java/com/zhiwei/brandkbs2/service/TableWordService.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportWordDTO
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
java.util.List
;
/**
* @ClassName: TableWordService
* @Description TableWordService
* @author: sjj
* @date: 2023-05-25 14:13
*/
public
interface
TableWordService
{
/**
* 分页查询词组列表
*
* @param page 页码
* @param size 页码大小
* @param keyword 关键词
* @return PageVO<JSONObject>
*/
PageVO
<
JSONObject
>
findWord
(
int
page
,
int
size
,
String
keyword
);
/**
* 添加词组
*
* @param words 词组
*/
ResponseResult
addWordList
(
List
<
String
>
words
,
String
projectId
,
String
submitter
);
/**
* 删除词组
*
* @param id 词组id
*/
void
deleteWord
(
String
id
);
/**
* 导出词组
*
* @return List<ExportWordDTO>
*/
List
<
ExportWordDTO
>
downloadWord
(
String
projectId
);
}
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
View file @
ae7cf13b
...
...
@@ -49,9 +49,10 @@ public interface UserService {
* @param keyword 关键字
* @param pid 项目ID
* @param role 角色
* @param sorter 排序
* @return 所有用户
*/
PageVO
<
JSONObject
>
findUserList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
int
role
);
PageVO
<
JSONObject
>
findUserList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
int
role
,
String
sorter
);
/**
* 添加用户
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
View file @
ae7cf13b
...
...
@@ -132,6 +132,13 @@ public class CommonServiceImpl implements CommonService {
}
@Override
public
Long
[]
getTimeRangeYear
()
{
long
endTime
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
).
getTime
();
long
startTime
=
DateUtils
.
addYears
(
new
Date
(
endTime
),
-
1
).
getTime
();
return
new
Long
[]{
startTime
,
endTime
};
}
@Override
public
Long
[]
getTimeRangeMonth
()
{
long
endTime
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
).
getTime
();
long
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/HighWordServiceImpl.java
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.HighWordDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportHighWordDTO
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.HighWordService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @ClassName: HighWordServiceImpl
* @Description 高频词服务接口实现类
...
...
@@ -23,49 +13,9 @@ import java.util.stream.Collectors;
* @date: 2022-06-06 10:02
*/
@Service
(
"highWordServiceImpl"
)
public
class
HighWordServiceImpl
implements
HighWordService
{
@Resource
(
name
=
"highWordDao"
)
HighWordDao
highWordDao
;
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
@Override
public
PageVO
<
JSONObject
>
findHighWord
(
int
page
,
int
size
,
String
keyword
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
Query
query
=
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
long
count
=
highWordDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
HighWord
>
highWordList
=
highWordDao
.
findListByKeywordFuzz
(
query
,
keyword
,
new
String
[]{
"keyword"
});
List
<
JSONObject
>
resList
=
highWordList
.
stream
().
map
(
highWord
->
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"id"
,
highWord
.
getId
());
result
.
put
(
"keyword"
,
highWord
.
getKeyword
());
result
.
put
(
"cTime"
,
highWord
.
getCTime
());
result
.
put
(
"submitter"
,
highWord
.
getSubmitter
());
return
result
;
}).
collect
(
Collectors
.
toList
());
MongoUtil
.
PageHelper
<
JSONObject
>
pageHelper
=
mongoUtil
.
pageHelper
(
count
,
resList
);
return
PageVO
.
createPageVo
(
pageHelper
,
resList
);
}
public
class
HighWordServiceImpl
extends
TableWordServiceImpl
implements
HighWordService
{
@Override
public
void
addHighWordList
(
List
<
String
>
highWords
)
{
List
<
String
>
existList
=
highWordDao
.
findList
(
null
).
stream
().
map
(
HighWord:
:
getKeyword
).
collect
(
Collectors
.
toList
());
// 去除重复数据
List
<
String
>
newList
=
highWords
.
stream
().
filter
(
word
->
!
existList
.
contains
(
word
)).
collect
(
Collectors
.
toList
());
highWordDao
.
insertMany
(
HighWord
.
createFromList
(
newList
,
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getNickname
()));
public
HighWordServiceImpl
(
@Qualifier
(
"highWordDao"
)
HighWordDao
highWordDao
,
@Qualifier
(
"mongoUtil"
)
MongoUtil
mongoUtil
)
{
super
(
highWordDao
,
mongoUtil
);
}
@Override
public
void
deleteHighWord
(
String
id
)
{
highWordDao
.
deleteOneById
(
id
);
}
@Override
public
List
<
ExportHighWordDTO
>
downloadHighWord
()
{
return
highWordDao
.
findList
(
null
).
stream
().
map
(
ExportHighWordDTO:
:
createFromHighWord
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/HighlightWordServiceImpl.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.service.HighlightWordService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
/**
* @ClassName: HighlightWordServiceImpl
* @Description HighlightWordServiceImpl
* @author: sjj
* @date: 2023-05-25 15:11
*/
@Service
(
"highlightWordServiceImpl"
)
public
class
HighlightWordServiceImpl
extends
TableWordServiceImpl
implements
HighlightWordService
{
public
HighlightWordServiceImpl
(
@Qualifier
(
"highlightWordDao"
)
HighlightWordDao
highlightWordDao
,
@Qualifier
(
"mongoUtil"
)
MongoUtil
mongoUtil
)
{
super
(
highlightWordDao
,
mongoUtil
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
ae7cf13b
...
...
@@ -15,6 +15,7 @@ import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.AggreeResultDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
...
...
@@ -149,6 +150,9 @@ public class MarkDataServiceImpl implements MarkDataService {
@Resource
(
name
=
"esSearchServiceImpl"
)
EsSearchService
esSearchService
;
@Resource
(
name
=
"highlightWordDao"
)
HighlightWordDao
highlightWordDao
;
@Override
public
PageVO
<
MarkFlowEntity
>
getOriginList
(
MarkSearchDTO
markSearchDTO
)
{
try
{
...
...
@@ -168,7 +172,7 @@ public class MarkDataServiceImpl implements MarkDataService {
// 返回分页结果并设置平台count
return
PageVO
.
createPageVo
(
total
,
markSearchDTO
.
getPage
(),
markSearchDTO
.
getPageSize
(),
flowEntityList
)
// 各平台计量
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
platformCount"
,
hitsAndCounts
.
getRight
(
))));
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
highlightWord"
,
highlightWordDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
UserThreadLocal
.
getProjectId
()))).
stream
().
map
(
HighlightWord:
:
getKeyword
).
collect
(
Collectors
.
toList
()
))));
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"es查询异常"
);
}
...
...
@@ -247,10 +251,10 @@ public class MarkDataServiceImpl implements MarkDataService {
long
total
=
hitsAndCounts
.
getLeft
()[
0
].
getTotalHits
().
value
;
// 消息列表
List
<
MarkFlowEntity
>
flowEntityList
=
getMarkFlowEntity
(
markSearchDTO
,
hitsAndCounts
.
getLeft
()[
0
]);
// 返回分页结果并
设置平台count
// 返回分页结果并
返回高亮关键词
return
PageVO
.
createPageVo
(
total
,
markSearchDTO
.
getPage
(),
markSearchDTO
.
getPageSize
(),
flowEntityList
)
//
各平台计量
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
platformCount"
,
hitsAndCounts
.
getRight
(
))));
//
高亮关键词
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
highlightWord"
,
GlobalPojo
.
HIGHLIGHT_MAP
.
get
(
UserThreadLocal
.
getProjectId
()
))));
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"es查询异常"
);
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
View file @
ae7cf13b
...
...
@@ -10,6 +10,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.HighlightWordDao
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
...
...
@@ -17,6 +18,7 @@ import com.zhiwei.brandkbs2.pojo.MarkFlowEntity;
import
com.zhiwei.brandkbs2.service.MarkFlowService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.automaticmark.vo.Keyword
;
import
com.zhiwei.middleware.cleaner.filter.UnifiedFilterClient
;
import
com.zhiwei.middleware.mark.service.MarkerClient
;
import
com.zhiwei.middleware.mark.vo.QueryResult
;
...
...
@@ -57,9 +59,11 @@ public class MarkFlowServiceImpl implements MarkFlowService {
@Resource
(
name
=
"filterClient"
)
UnifiedFilterClient
filterClient
;
@Resource
(
name
=
"highlightWordDao"
)
HighlightWordDao
highlightWordDao
;
@Override
public
JSONObject
createMarkFlowInfo
(
MarkInfoSource
markInfoSource
)
{
JSONObject
resultInfo
=
createInfoWithEmotion
(
markInfoSource
.
getJson
());
resultInfo
.
put
(
"sourceDetails"
,
getSourceDetails
(
markInfoSource
));
return
resultInfo
;
...
...
@@ -70,7 +74,7 @@ public class MarkFlowServiceImpl implements MarkFlowService {
JSONObject
json
=
markInfoSource
.
getJson
();
String
linkedGroupId
=
markInfoSource
.
getLinkedGroupId
();
JSONObject
resultInfo
=
createInfoWithEmotion
(
json
);
resultInfo
.
put
(
"sourceDetails"
,
getSourceDetails4Origin
(
json
,
linkedGroupId
));
resultInfo
.
put
(
"sourceDetails"
,
getSourceDetails4Origin
(
json
,
UserThreadLocal
.
getProjectId
(),
linkedGroupId
));
String
zip
=
Tools
.
gzip
(
JSON
.
toJSONString
(
json
));
resultInfo
.
put
(
"zip"
,
zip
);
return
resultInfo
;
...
...
@@ -229,10 +233,11 @@ public class MarkFlowServiceImpl implements MarkFlowService {
// 保留两位小数
sourceDetails
.
put
(
"channelInfluence"
,
new
BigDecimal
(
channelValue
).
setScale
(
2
,
RoundingMode
.
UP
));
}
sourceDetails
.
put
(
"highlightWordMap"
,
getHighlightWordMap
(
markInfoSource
.
getProjectId
(),
tJson
));
return
sourceDetails
;
}
private
JSONObject
getSourceDetails4Origin
(
JSONObject
tJson
,
String
linkedGroupId
)
{
private
JSONObject
getSourceDetails4Origin
(
JSONObject
tJson
,
String
projectId
,
String
linkedGroupId
)
{
JSONObject
sourceDetails
=
new
JSONObject
();
String
source
=
tJson
.
getString
(
GenericAttribute
.
ES_SOURCE
);
// 是否原创
...
...
@@ -251,9 +256,36 @@ public class MarkFlowServiceImpl implements MarkFlowService {
if
(
followersNum
>
0
)
{
sourceDetails
.
put
(
"followersNum"
,
followersNum
);
}
sourceDetails
.
put
(
"highlightWordMap"
,
getHighlightWordMap
(
projectId
,
tJson
));
return
sourceDetails
;
}
private
Map
<
String
,
Integer
>
getHighlightWordMap
(
String
projectId
,
JSONObject
json
)
{
List
<
Keyword
>
hitKeywords
=
GlobalPojo
.
PROJECT_GRAPHS
.
get
(
projectId
).
find
(
json
.
getString
(
GenericAttribute
.
ES_IND_FULL_TEXT
));
List
<
String
>
preWords
=
GlobalPojo
.
HIGHLIGHT_MAP
.
get
(
projectId
);
if
(
null
!=
preWords
&&
!
hitKeywords
.
isEmpty
())
{
Map
<
String
,
Integer
>
resMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
hitMap
=
new
HashMap
<>();
hitKeywords
.
forEach
(
keyword
->
hitMap
.
compute
(
keyword
.
getKey
(),
(
k
,
v
)
->
null
==
v
?
1
:
++
v
));
outer:
for
(
String
preWord
:
preWords
)
{
Integer
count
=
null
;
String
[]
split
=
preWord
.
trim
().
split
(
" +"
);
for
(
String
s
:
split
)
{
Integer
rate
=
hitMap
.
get
(
s
);
// 未命中词语
if
(
null
==
rate
)
{
continue
outer
;
}
count
=
count
==
null
?
rate
:
Math
.
min
(
count
,
rate
);
}
resMap
.
put
(
preWord
,
count
);
}
return
Tools
.
sortMap
(
resMap
,
null
);
}
return
null
;
}
/**
* 按c4、origin获取ClientFrom
*
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
View file @
ae7cf13b
...
...
@@ -427,6 +427,12 @@ public class ProjectServiceImpl implements ProjectService {
}
}
@Override
public
List
<
String
>
getHighlightKeyword
(
String
projectId
)
{
Project
project
=
projectDao
.
findOneById
(
projectId
);
return
Objects
.
requireNonNull
(
project
).
getHighlightKeyword
();
}
/**
* 获取舆情对应项目的情感标签
* @param brandName
...
...
@@ -448,8 +454,12 @@ public class ProjectServiceImpl implements ProjectService {
}
else
{
lists
=
new
ArrayList
<>();
user
.
getRoles
().
forEach
(
userRole
->
{
lists
.
add
(
projectDao
.
findOneById
(
userRole
.
getProjectId
()));
roleExpired
.
put
(
userRole
.
getProjectId
(),
null
==
userRole
.
getExpiredTime
()
?
null
:
new
Date
(
userRole
.
getExpiredTime
()));
Project
project
=
projectDao
.
findOneById
(
userRole
.
getProjectId
());
// 项目可能被删除
if
(
null
!=
project
)
{
lists
.
add
(
projectDao
.
findOneById
(
userRole
.
getProjectId
()));
roleExpired
.
put
(
userRole
.
getProjectId
(),
null
==
userRole
.
getExpiredTime
()
?
null
:
new
Date
(
userRole
.
getExpiredTime
()));
}
});
}
return
lists
.
stream
().
filter
(
Project:
:
isShow
).
map
(
project
->
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TableWordServiceImpl.java
0 → 100644
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.BaseMongoDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportWordDTO
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.AbstractBaseWord
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.TableWordService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @ClassName: TableWordServiceImpl
* @Description TableWordServiceImpl
* @author: sjj
* @date: 2023-05-25 14:35
*/
public
class
TableWordServiceImpl
implements
TableWordService
{
final
BaseMongoDao
<?
extends
AbstractBaseWord
>
baseMongoDao
;
final
MongoUtil
mongoUtil
;
public
TableWordServiceImpl
(
BaseMongoDao
<?
extends
AbstractBaseWord
>
baseMongoDao
,
MongoUtil
mongoUtil
)
{
this
.
baseMongoDao
=
baseMongoDao
;
this
.
mongoUtil
=
mongoUtil
;
}
@Override
public
PageVO
<
JSONObject
>
findWord
(
int
page
,
int
size
,
String
keyword
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
Query
query
=
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
long
count
=
baseMongoDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<?
extends
AbstractBaseWord
>
highWordList
=
baseMongoDao
.
findListByKeywordFuzz
(
query
,
keyword
,
new
String
[]{
"keyword"
});
List
<
JSONObject
>
resList
=
highWordList
.
stream
().
map
(
highWord
->
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"id"
,
highWord
.
getId
());
result
.
put
(
"keyword"
,
highWord
.
getKeyword
());
result
.
put
(
"cTime"
,
highWord
.
getCTime
());
result
.
put
(
"submitter"
,
highWord
.
getSubmitter
());
return
result
;
}).
collect
(
Collectors
.
toList
());
MongoUtil
.
PageHelper
<
JSONObject
>
pageHelper
=
mongoUtil
.
pageHelper
(
count
,
resList
);
return
PageVO
.
createPageVo
(
pageHelper
,
resList
);
}
@Override
public
ResponseResult
addWordList
(
List
<
String
>
words
,
String
projectId
,
String
submitter
)
{
List
<
String
>
existList
=
baseMongoDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
))).
stream
().
map
(
AbstractBaseWord:
:
getKeyword
).
collect
(
Collectors
.
toList
());
// 去除重复数据
List
<
String
>
newList
=
words
.
stream
().
filter
(
word
->
!
existList
.
contains
(
word
)).
collect
(
Collectors
.
toList
());
// 关键词100上限
if
(
newList
.
size
()
+
existList
.
size
()
>
100
)
{
return
ResponseResult
.
failure
(
"关键词添加超过上限值100"
);
}
baseMongoDao
.
insertMany
(
HighWord
.
createFromList
(
newList
,
projectId
,
submitter
));
return
ResponseResult
.
success
();
}
@Override
public
void
deleteWord
(
String
id
)
{
baseMongoDao
.
deleteOneById
(
id
);
}
@Override
public
List
<
ExportWordDTO
>
downloadWord
(
String
projectId
)
{
return
baseMongoDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
))).
stream
().
map
(
ExportWordDTO:
:
createFromWord
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
ae7cf13b
...
...
@@ -133,13 +133,13 @@ public class UserServiceImpl implements UserService {
}
@Override
public
PageVO
<
JSONObject
>
findUserList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
int
role
)
{
public
PageVO
<
JSONObject
>
findUserList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
int
role
,
String
sorter
)
{
Criteria
criteria
=
Criteria
.
where
(
"roles.projectId"
).
is
(
pid
).
and
(
"superAdmin"
).
is
(
false
);
if
(-
1
!=
role
)
{
criteria
=
criteria
.
andOperator
(
Criteria
.
where
(
"roles.key"
).
is
(
Tools
.
concat
(
pid
,
role
)));
// criteria = criteria.andOperator(Criteria.where("roles.roleId").is(role));
}
return
findList
(
page
,
size
,
keyword
,
pid
,
new
Query
(
criteria
));
return
findList
(
page
,
size
,
keyword
,
pid
,
new
Query
(
criteria
)
,
sorter
);
}
@Override
...
...
@@ -149,6 +149,7 @@ public class UserServiceImpl implements UserService {
ExceptionCast
.
cast
(
CommonCodeEnum
.
UN_AUTHORISE
);
}
int
roleId
=
UserThreadLocal
.
getRoleId
();
String
nickname
=
UserThreadLocal
.
getNickname
();
// 只有超管能设置管理员
if
(
roleId
!=
RoleEnum
.
SUPER_ADMIN
.
getState
()
&&
userDTO
.
getRoleId
()
<=
RoleEnum
.
ADMIN
.
getState
())
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
UN_AUTHORISE
);
...
...
@@ -166,15 +167,16 @@ public class UserServiceImpl implements UserService {
User
newUser
;
// 优先使用用户中心信息
if
(
null
!=
centerUser
)
{
newUser
=
User
.
createFromCenterUser
(
centerUser
);
newUser
=
User
.
createFromCenterUser
(
centerUser
,
nickname
);
newUser
.
setNickname
(
userDTO
.
getNickname
());
newUser
.
setRoles
(
Collections
.
singletonList
(
UserRole
.
createFromUserDto
(
userDTO
)));
newUser
.
setSuperAdmin
(
false
);
userDao
.
insertOne
(
newUser
);
userCenterService
.
addProduct
(
newUser
.
getId
());
}
else
{
newUser
=
createNewUser
(
userDTO
);
newUser
=
User
.
createFromUserDTO
(
userDTO
,
nickname
);
userDao
.
insertOne
(
newUser
);
}
userDao
.
insertOne
(
newUser
);
userCenterService
.
addProduct
(
newUser
.
getId
());
return
ResponseResult
.
success
();
}
List
<
UserRole
>
roles
=
user
.
getRoles
();
...
...
@@ -190,6 +192,7 @@ public class UserServiceImpl implements UserService {
roles
.
add
(
UserRole
.
createFromUserDto
(
userDTO
));
Update
update
=
new
Update
();
update
.
set
(
"roles"
,
roles
);
update
.
set
(
"submitter"
,
nickname
);
userDao
.
updateOneByIdWithField
(
userDTO
.
getId
(),
update
);
return
ResponseResult
.
success
();
}
...
...
@@ -203,6 +206,7 @@ public class UserServiceImpl implements UserService {
List
<
UserRole
>
roles
=
user
.
getRoles
().
stream
().
filter
(
userRole
->
!
userRole
.
getProjectId
().
equals
(
pid
)).
collect
(
Collectors
.
toList
());
Update
update
=
new
Update
();
update
.
set
(
"roles"
,
roles
);
update
.
set
(
"submitter"
,
UserThreadLocal
.
getNickname
());
userDao
.
updateOneByIdWithField
(
userId
,
update
);
}
...
...
@@ -230,7 +234,7 @@ public class UserServiceImpl implements UserService {
@Override
public
PageVO
<
JSONObject
>
findSuperAdminList
(
int
page
,
int
size
,
String
keyword
)
{
Query
query
=
new
Query
().
addCriteria
(
Criteria
.
where
(
"superAdmin"
).
is
(
true
));
return
findList
(
page
,
size
,
keyword
,
null
,
query
);
return
findList
(
page
,
size
,
keyword
,
null
,
query
,
null
);
}
@Override
...
...
@@ -242,26 +246,28 @@ public class UserServiceImpl implements UserService {
return
ResponseResult
.
failure
(
"用户中心注册账号失败"
);
}
}
String
nickname
=
UserThreadLocal
.
getNickname
();
User
user
=
userDao
.
findOneById
(
userDTO
.
getId
());
// 老用户
if
(
null
!=
user
)
{
if
(!
user
.
isSuperAdmin
())
{
Update
update
=
new
Update
();
update
.
set
(
"superAdmin"
,
true
);
update
.
set
(
"roles"
,
null
);
userDao
.
updateOneByIdWithField
(
user
.
getId
(),
update
);
if
(
user
.
isSuperAdmin
())
{
return
ResponseResult
.
success
();
}
Update
update
=
new
Update
();
update
.
set
(
"superAdmin"
,
true
);
update
.
set
(
"submitter"
,
nickname
);
userDao
.
updateOneByIdWithField
(
user
.
getId
(),
update
);
return
ResponseResult
.
success
();
}
// 新用户
User
newUser
;
// 优先使用用户中心信息
if
(
null
!=
centerUser
)
{
newUser
=
User
.
createFromCenterUser
(
centerUser
);
newUser
=
User
.
createFromCenterUser
(
centerUser
,
nickname
);
newUser
.
setNickname
(
userDTO
.
getNickname
());
newUser
.
setSuperAdmin
(
true
);
}
else
{
newUser
=
createNewUser
(
userDTO
);
newUser
=
User
.
createFromUserDTO
(
userDTO
,
nickname
);
}
userDao
.
insertOne
(
newUser
);
userCenterService
.
addProduct
(
newUser
.
getId
());
...
...
@@ -275,6 +281,7 @@ public class UserServiceImpl implements UserService {
@Override
public
List
<
JSONObject
>
bindUser
(
String
username
,
String
password
)
{
String
nickname
=
UserThreadLocal
.
getNickname
();
UserOldDaoImpl
.
UserOld
userOld
=
userOldDao
.
findOneByUsernameAndPassword
(
username
,
password
);
if
(
null
==
userOld
)
{
ExceptionCast
.
cast
(
LoginCodeEnum
.
LOGIN_USERNAME_OR_PASSWORD_ERROR
);
...
...
@@ -286,7 +293,7 @@ public class UserServiceImpl implements UserService {
if
(
null
==
user
)
{
// 通过用户中心查询
CenterUser
centerUser
=
userInfoClient
.
getUserById
(
Integer
.
parseInt
(
UserThreadLocal
.
getUserId
()));
user
=
User
.
createFromCenterUser
(
centerUser
);
user
=
User
.
createFromCenterUser
(
centerUser
,
nickname
);
}
// 超级管理员
if
(
userOld
.
isSuperAdmin
())
{
...
...
@@ -330,7 +337,7 @@ public class UserServiceImpl implements UserService {
@Override
public
List
<
JSONObject
>
skipBindUser
()
{
CenterUser
centerUser
=
userInfoClient
.
getUserById
(
Integer
.
parseInt
(
UserThreadLocal
.
getUserId
()));
User
user
=
User
.
createFromCenterUser
(
centerUser
).
defaultRoleUser
();
User
user
=
User
.
createFromCenterUser
(
centerUser
,
"admin"
).
defaultRoleUser
();
userDao
.
insertOne
(
user
);
return
projectServiceImpl
.
getProjectListByUser
(
user
,
true
);
}
...
...
@@ -414,25 +421,13 @@ public class UserServiceImpl implements UserService {
return
queryUserInfo
(
UserThreadLocal
.
getUserId
(),
UserThreadLocal
.
getProjectId
()).
toMap
();
}
private
User
createNewUser
(
UserDTO
userDTO
)
{
User
user
=
new
User
();
user
.
setId
(
userDTO
.
getId
());
user
.
setNickname
(
userDTO
.
getNickname
());
user
.
setCTime
(
System
.
currentTimeMillis
());
user
.
setUsername
(
userDTO
.
getUsername
());
user
.
setPhoneNumber
(
userDTO
.
getPhoneNumber
());
if
(
RoleEnum
.
SUPER_ADMIN
.
getState
()
==
userDTO
.
getRoleId
())
{
user
.
setSuperAdmin
(
true
);
private
PageVO
<
JSONObject
>
findList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
Query
query
,
String
sorter
)
{
userDao
.
addKeywordFuzz
(
query
,
keyword
,
"nickname"
);
if
(
null
==
sorter
)
{
userDao
.
addSort
(
query
,
"{\"cTime\":\"descend\"}"
);
}
else
{
user
.
setRoles
(
Collections
.
singletonList
(
UserRole
.
createFromUserDto
(
userDTO
)));
user
.
setSuperAdmin
(
false
);
userDao
.
addSort
(
query
,
sorter
);
}
return
user
;
}
private
PageVO
<
JSONObject
>
findList
(
int
page
,
int
size
,
String
keyword
,
String
pid
,
Query
query
)
{
userDao
.
addKeywordFuzz
(
query
,
keyword
,
"nickname"
);
userDao
.
addSort
(
query
,
"{\"cTime\":\"descend\"}"
);
long
count
=
userDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
User
>
userList
=
userDao
.
findList
(
query
);
...
...
@@ -443,6 +438,7 @@ public class UserServiceImpl implements UserService {
result
.
put
(
"username"
,
user
.
getUsername
());
result
.
put
(
"cTime"
,
user
.
getCTime
());
result
.
put
(
"phoneNumber"
,
user
.
getPhoneNumber
());
result
.
put
(
"submitter"
,
user
.
getSubmitter
());
Optional
.
ofNullable
(
user
.
getRoles
()).
flatMap
(
roles
->
roles
.
stream
().
filter
(
ur
->
{
if
(
null
==
pid
)
{
return
true
;
...
...
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
View file @
ae7cf13b
...
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.util;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Component
;
...
...
@@ -92,15 +93,35 @@ public class RedisUtil {
return
stringRedisTemplate
.
keys
(
key
);
}
public
void
setListLeft
(
String
key
,
String
value
)
{
if
(
null
==
key
)
{
return
;
public
List
<
Object
>
getMapValueAll
(
String
key
)
{
return
stringRedisTemplate
.
opsForHash
().
values
(
key
);
}
public
boolean
setMapValue
(
String
key
,
String
field
,
String
value
)
{
HashOperations
<
String
,
Object
,
Object
>
operations
=
stringRedisTemplate
.
opsForHash
();
Boolean
result
=
operations
.
putIfAbsent
(
key
,
field
,
value
);
return
Boolean
.
TRUE
.
equals
(
result
);
}
public
boolean
resetMapValue
(
String
key
,
String
field
,
String
newField
,
String
value
)
{
HashOperations
<
String
,
Object
,
Object
>
operations
=
stringRedisTemplate
.
opsForHash
();
if
(
operations
.
hasKey
(
key
,
field
))
{
operations
.
put
(
key
,
newField
,
value
);
deleteMapValue
(
key
,
field
);
return
true
;
}
return
false
;
}
public
void
deleteMapValue
(
String
key
,
String
field
)
{
HashOperations
<
String
,
Object
,
Object
>
operations
=
stringRedisTemplate
.
opsForHash
();
if
(
operations
.
hasKey
(
key
,
field
))
{
operations
.
delete
(
key
,
field
);
}
stringRedisTemplate
.
opsForList
().
leftPush
(
key
,
value
);
}
public
List
<
String
>
getListAll
(
String
key
)
{
return
stringRedisTemplate
.
opsFor
List
().
range
(
key
,
0
,
-
1
);
public
long
getMapSize
(
String
key
)
{
return
stringRedisTemplate
.
opsFor
Hash
().
size
(
key
);
}
public
void
remove
(
String
key
)
{
...
...
src/main/resources/application-dev.properties
View file @
ae7cf13b
...
...
@@ -84,7 +84,9 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url
=
https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url
=
https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5
\}
&accurateWord={6}
trends.queryHotSearchTrendInner.url
=
https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url
=
https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
ef.searchCriteria.url
=
https://ef.zhiweidata.com/index/getSearchKey.do
...
...
@@ -99,7 +101,7 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token
=
AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
?projectId={1}&projectName={2}
warn.project.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
warn.ticket.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
...
...
src/main/resources/application-local.properties
View file @
ae7cf13b
...
...
@@ -87,7 +87,10 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url
=
https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url
=
https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
http://192.168.0.192:9091/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}
trends.queryHotSearchTrendInner.url
=
http://192.168.27.203:9094/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url
=
https://ef.zhiweidata.com/external/search.do?name={1}&page={2}&size={3}
ef.searchCriteria.url
=
https://ef.zhiweidata.com/index/getSearchKey.do
...
...
@@ -102,7 +105,7 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token
=
AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/project
?projectId={1}&projectName={2}
warn.project.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/project
warn.ticket.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
...
...
src/main/resources/application-prod.properties
View file @
ae7cf13b
...
...
@@ -84,7 +84,9 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url
=
https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url
=
https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}
trends.queryHotSearchTrendInner.url
=
https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url
=
https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
ef.searchCriteria.url
=
https://ef.zhiweidata.com/index/getSearchKey.do
...
...
@@ -99,7 +101,7 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token
=
AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
?projectId={1}&projectName={2}
warn.project.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
warn.ticket.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
...
...
src/test/java/com/zhiwei/brandkbs2/HighWordServiceTest.java
View file @
ae7cf13b
package
com
.
zhiwei
.
brandkbs2
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportHighWordDTO
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportWordDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.HighWordService
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tags
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -21,7 +21,7 @@ public class HighWordServiceTest {
@Test
public
void
findHighWordTest
(){
PageVO
<
JSONObject
>
ls
=
highWordService
.
find
High
Word
(
1
,
10
,
"里"
);
PageVO
<
JSONObject
>
ls
=
highWordService
.
findWord
(
1
,
10
,
"里"
);
for
(
JSONObject
jsonObject
:
ls
.
getList
())
{
System
.
out
.
println
(
jsonObject
);
}
...
...
@@ -29,8 +29,8 @@ public class HighWordServiceTest {
@Test
public
void
downloadHighWordTest
(){
List
<
Export
HighWordDTO
>
exportHighWordDTOS
=
highWordService
.
downloadHighWord
(
);
for
(
Export
High
WordDTO
exportHighWordDTO
:
exportHighWordDTOS
)
{
List
<
Export
WordDTO
>
exportHighWordDTOS
=
highWordService
.
downloadWord
(
Constant
.
DEFAULT_PROJECT_ID
);
for
(
ExportWordDTO
exportHighWordDTO
:
exportHighWordDTOS
)
{
System
.
out
.
println
(
exportHighWordDTO
);
}
}
...
...
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