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
3c5dcb4d
Commit
3c5dcb4d
authored
Sep 09, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022/9/9 10:23
parent
84d7a78a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
21 deletions
+68
-21
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
+13
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+4
-13
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ChannelSearchDTO.java
+43
-0
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+1
-1
No files found.
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
View file @
3c5dcb4d
...
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
...
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -47,6 +48,10 @@ public class GlobalPojo {
...
@@ -47,6 +48,10 @@ public class GlobalPojo {
*/
*/
public
static
Map
<
String
,
Map
<
String
,
String
>>
MEDIA_TYPE
;
public
static
Map
<
String
,
Map
<
String
,
String
>>
MEDIA_TYPE
;
public
static
final
List
<
String
>
PERMANENT_PLATFORM_NAMES
=
Arrays
.
asList
(
"网媒"
,
"微博"
,
"微信"
,
"今日头条"
);
public
static
final
String
ELSE_PLATFORM_NAME
=
"其他自媒体"
;
@PostConstruct
@PostConstruct
public
void
start
()
{
public
void
start
()
{
try
{
try
{
...
@@ -92,6 +97,14 @@ public class GlobalPojo {
...
@@ -92,6 +97,14 @@ public class GlobalPojo {
return
null
;
return
null
;
}
}
public
static
String
getPermanentPlatformNameById
(
String
platformId
)
{
String
platformName
=
getPlatformNameById
(
platformId
);
if
(
PERMANENT_PLATFORM_NAMES
.
contains
(
platformName
))
{
return
platformName
;
}
return
ELSE_PLATFORM_NAME
;
}
public
static
String
getMediaType
(
String
projectId
,
String
platform
,
String
source
)
{
public
static
String
getMediaType
(
String
projectId
,
String
platform
,
String
source
)
{
return
MEDIA_TYPE
.
get
(
projectId
).
get
(
platform
+
source
);
return
MEDIA_TYPE
.
get
(
projectId
).
get
(
platform
+
source
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
3c5dcb4d
...
@@ -9,10 +9,7 @@ import com.zhiwei.brandkbs2.controller.BaseController;
...
@@ -9,10 +9,7 @@ import com.zhiwei.brandkbs2.controller.BaseController;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.*
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportSearchWholeDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -181,15 +178,9 @@ public class AppSearchController extends BaseController {
...
@@ -181,15 +178,9 @@ public class AppSearchController extends BaseController {
@ApiOperation
(
"搜索-渠道列表"
)
@ApiOperation
(
"搜索-渠道列表"
)
@PostMapping
(
value
=
"/channel/channelList"
)
@PostMapping
(
value
=
"/channel/channelList"
)
public
ResponseResult
getChannelList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
public
ResponseResult
getChannelList
(
@RequestBody
ChannelSearchDTO
channelSearchDTO
)
{
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
int
pageSize
,
return
ResponseResult
.
success
(
channelService
.
getChannelList
(
channelSearchDTO
.
getPage
(),
channelSearchDTO
.
getPageSize
(),
channelSearchDTO
.
getKeyword
(),
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
channelSearchDTO
.
getPlatform
(),
channelSearchDTO
.
getEmotions
(),
channelSearchDTO
.
getMediaTypes
(),
channelSearchDTO
.
getArticlesCount
(),
channelSearchDTO
.
getSorter
()));
@RequestParam
(
value
=
"platforms"
,
required
=
false
)
List
<
String
>
platforms
,
@RequestParam
(
value
=
"emotions"
,
required
=
false
)
List
<
Integer
>
emotions
,
@RequestParam
(
value
=
"mediaTypes"
,
required
=
false
)
List
<
String
>
mediaTypes
,
@RequestParam
(
value
=
"articlesCount"
,
required
=
false
)
String
[]
articlesCount
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"influence\":\"descend\"}"
)
String
sorter
)
{
return
ResponseResult
.
success
(
channelService
.
getChannelList
(
page
,
pageSize
,
keyword
,
platforms
,
emotions
,
mediaTypes
,
articlesCount
,
sorter
));
}
}
@ApiOperation
(
"搜索-热门事件"
)
@ApiOperation
(
"搜索-热门事件"
)
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ChannelSearchDTO.java
0 → 100644
View file @
3c5dcb4d
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName: ChannelSearchDTO
* @Description ChannelSearchDTO
* @author: sjj
* @date: 2022-09-08 11:10
*/
@Data
@ApiModel
(
"渠道搜索传输类"
)
public
class
ChannelSearchDTO
{
@ApiModelProperty
(
"页码"
)
private
int
page
=
1
;
@ApiModelProperty
(
"页码大小"
)
private
int
pageSize
=
20
;
@ApiModelProperty
(
"关键词"
)
private
String
keyword
;
@ApiModelProperty
(
"平台"
)
private
List
<
String
>
platform
;
@ApiModelProperty
(
"情感倾向"
)
private
List
<
Integer
>
emotions
;
@ApiModelProperty
(
"媒体类型"
)
private
List
<
String
>
mediaTypes
;
@ApiModelProperty
(
"文章数"
)
private
Integer
[]
articlesCount
;
@ApiModelProperty
(
"排序字段"
)
private
String
sorter
=
"{\"influence\":\"descend\"}"
;
}
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
View file @
3c5dcb4d
...
@@ -260,6 +260,6 @@ public interface ChannelService {
...
@@ -260,6 +260,6 @@ public interface ChannelService {
JSONObject
getChannelSearchCriteria
();
JSONObject
getChannelSearchCriteria
();
PageVO
<
ChannelVO
>
getChannelList
(
int
page
,
int
pageSize
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
PageVO
<
ChannelVO
>
getChannelList
(
int
page
,
int
pageSize
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
String
[]
articlesCount
,
String
sorter
);
Integer
[]
articlesCount
,
String
sorter
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
3c5dcb4d
...
@@ -805,14 +805,14 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -805,14 +805,14 @@ public class ChannelServiceImpl implements ChannelService {
@Override
@Override
public
PageVO
<
ChannelVO
>
getChannelList
(
int
page
,
int
pageSize
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
public
PageVO
<
ChannelVO
>
getChannelList
(
int
page
,
int
pageSize
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
String
[]
articlesCount
,
String
sorter
)
{
Integer
[]
articlesCount
,
String
sorter
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
contendId
=
"0"
;
String
contendId
=
"0"
;
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
projectId
,
contendId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
projectId
,
contendId
).
getBrandLinkedGroupId
();
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"contendId"
).
is
(
contendId
));
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"contendId"
).
is
(
contendId
));
channelDao
.
addKeywordFuzz
(
query
,
keyword
,
"source"
);
channelDao
.
addKeywordFuzz
(
query
,
keyword
,
"source"
);
if
(!(
null
==
platforms
||
platforms
.
contains
(
"全部"
)))
{
if
(!(
null
==
platforms
||
platforms
.
contains
(
"全部"
)))
{
query
.
addCriteria
(
Criteria
.
where
(
"platform"
).
in
(
platforms
));
query
.
addCriteria
(
Criteria
.
where
(
"platform"
).
in
(
platforms
.
stream
().
map
(
GlobalPojo:
:
getPlatformNameById
).
collect
(
Collectors
.
toList
())
));
}
}
if
(!(
null
==
emotions
||
emotions
.
contains
(-
1
)))
{
if
(!(
null
==
emotions
||
emotions
.
contains
(-
1
)))
{
query
.
addCriteria
(
Criteria
.
where
(
"emotion"
).
in
(
emotions
));
query
.
addCriteria
(
Criteria
.
where
(
"emotion"
).
in
(
emotions
));
...
@@ -823,8 +823,8 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -823,8 +823,8 @@ public class ChannelServiceImpl implements ChannelService {
if
(
null
!=
articlesCount
)
{
if
(
null
!=
articlesCount
)
{
query
.
addCriteria
(
Criteria
.
where
(
"articleCount"
).
gte
(
articlesCount
[
0
]).
lt
(
articlesCount
[
1
]));
query
.
addCriteria
(
Criteria
.
where
(
"articleCount"
).
gte
(
articlesCount
[
0
]).
lt
(
articlesCount
[
1
]));
}
}
mongoUtil
.
start
(
page
,
pageSize
,
query
);
long
total
=
channelDao
.
count
(
query
);
long
total
=
channelDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
pageSize
,
query
);
channelDao
.
addSort
(
query
,
sorter
);
channelDao
.
addSort
(
query
,
sorter
);
List
<
Channel
>
channelList
=
channelDao
.
findList
(
query
);
List
<
Channel
>
channelList
=
channelDao
.
findList
(
query
);
List
<
CompletableFuture
<
JSONObject
>>
futureList
=
channelList
.
stream
().
map
(
channel
->
CompletableFuture
.
supplyAsync
(()
->
{
List
<
CompletableFuture
<
JSONObject
>>
futureList
=
channelList
.
stream
().
map
(
channel
->
CompletableFuture
.
supplyAsync
(()
->
{
...
@@ -1395,9 +1395,9 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1395,9 +1395,9 @@ public class ChannelServiceImpl implements ChannelService {
String
platformId
=
GlobalPojo
.
getPlatformIdByName
(
platform
);
String
platformId
=
GlobalPojo
.
getPlatformIdByName
(
platform
);
if
(
null
!=
platformId
)
{
if
(
null
!=
platformId
)
{
query
.
must
(
QueryBuilders
.
termQuery
(
GenericAttribute
.
ES_PLATFORM_ID
,
platformId
));
query
.
must
(
QueryBuilders
.
termQuery
(
GenericAttribute
.
ES_PLATFORM_ID
,
platformId
));
}
else
if
(
"其他自媒体"
.
equals
(
platform
))
{
}
else
if
(
GlobalPojo
.
ELSE_PLATFORM_NAME
.
equals
(
platform
))
{
// 不是 网媒,微博,微信,今日头条
// 不是 网媒,微博,微信,今日头条
EsQueryTools
.
platformMustNot
(
query
,
"网媒"
,
"平媒"
,
"微博"
,
"微信"
,
"今日头条"
);
EsQueryTools
.
platformMustNot
(
query
,
GlobalPojo
.
PERMANENT_PLATFORM_NAMES
.
toArray
(
new
String
[
0
])
);
}
}
// keyword
// keyword
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
View file @
3c5dcb4d
...
@@ -308,7 +308,7 @@ public class IndexServiceImpl implements IndexService {
...
@@ -308,7 +308,7 @@ public class IndexServiceImpl implements IndexService {
}
catch
(
IOException
ignored
)
{
}
catch
(
IOException
ignored
)
{
count
=
-
1
;
count
=
-
1
;
}
}
result
.
put
(
"platform"
,
GlobalPojo
.
getPlatformNameById
(
platformId
));
result
.
put
(
"platform"
,
GlobalPojo
.
getP
ermanentP
latformNameById
(
platformId
));
result
.
put
(
"num"
,
count
);
result
.
put
(
"num"
,
count
);
result
.
put
(
"proportion"
,
normalCount
==
0
?
0
d
:
count
/
(
double
)
normalCount
);
result
.
put
(
"proportion"
,
normalCount
==
0
?
0
d
:
count
/
(
double
)
normalCount
);
resultList
.
add
(
result
);
resultList
.
add
(
result
);
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
3c5dcb4d
...
@@ -782,7 +782,7 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -782,7 +782,7 @@ public class MarkDataServiceImpl implements MarkDataService {
line
.
put
(
"time"
,
day
.
getLongValue
(
"date"
));
line
.
put
(
"time"
,
day
.
getLongValue
(
"date"
));
lineList
.
add
(
line
);
lineList
.
add
(
line
);
});
});
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resul
t
));
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
lineLis
t
));
return
lineList
;
return
lineList
;
}
}
...
...
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