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
628bd882
Commit
628bd882
authored
Aug 22, 2022
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022/8/22 15:22 修改竞品库相关接口错误
parent
bb6734c5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
56 deletions
+150
-56
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
+17
-7
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+7
-7
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+18
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+107
-39
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
View file @
628bd882
...
@@ -2,14 +2,17 @@ package com.zhiwei.brandkbs2.controller.app;
...
@@ -2,14 +2,17 @@ package com.zhiwei.brandkbs2.controller.app;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
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.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -34,26 +37,33 @@ public class AppContendController extends BaseController {
...
@@ -34,26 +37,33 @@ public class AppContendController extends BaseController {
@ApiOperation
(
"竞品库-竞品舆情-搜索条件"
)
@ApiOperation
(
"竞品库-竞品舆情-搜索条件"
)
@GetMapping
(
"/searchCriteria"
)
@GetMapping
(
"/searchCriteria"
)
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
linkedGroup
Id
)
{
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
contend
Id
)
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
linkedGroup
Id
));
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
contend
Id
));
}
}
@ApiOperation
(
"竞品库-竞品舆情-搜索结果列表"
)
@ApiOperation
(
"竞品库-竞品舆情-搜索结果列表"
)
@
Ge
tMapping
(
"/list"
)
@
Pos
tMapping
(
"/list"
)
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
public
ResponseResult
getContendSearchList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchList
(
markSearchDTO
));
return
ResponseResult
.
success
(
markDataService
.
getContendSearchList
(
markSearchDTO
));
}
}
@ApiOperation
(
"竞品库-竞品分析-舆情总结页面"
)
@ApiOperation
(
"竞品库-竞品分析-舆情总结页面"
)
@
Ge
tMapping
(
"/summary"
)
@
Pos
tMapping
(
"/summary"
)
public
ResponseResult
getSummary
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
public
ResponseResult
getSummary
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
markSearchDTO
,
true
));
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
markSearchDTO
,
true
));
// 测试时关闭缓存,记得打开
}
}
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@
Ge
tMapping
(
"/spread/analyze"
)
@
Pos
tMapping
(
"/spread/analyze"
)
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
// 测试时关闭缓存,记得打开
}
}
@ApiOperation
(
"竞品库-竞品舆情-舆情导出"
)
@PostMapping
(
value
=
"/list/export"
)
public
ResponseResult
exportContendMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
stringListPair
=
markDataService
.
downloadContendMarkList
(
markSearchDTO
);
EasyExcelUtil
.
download
(
stringListPair
.
getLeft
()
+
"_舆情列表数据"
,
"sheet1"
,
ExportAppYuqingDTO
.
class
,
stringListPair
.
getRight
(),
response
);
return
ResponseResult
.
success
();
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
628bd882
...
@@ -49,9 +49,9 @@ public class AppSearchController {
...
@@ -49,9 +49,9 @@ public class AppSearchController {
@RequestParam
(
value
=
"type"
,
defaultValue
=
"weibo"
)
String
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"weibo"
)
String
type
,
@RequestParam
(
value
=
"word"
)
String
word
){
@RequestParam
(
value
=
"word"
)
String
word
){
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
trendsSearchUrl
,
JSONObject
.
class
,
limit
,
page
,
type
,
word
);
ResponseEntity
<
JSONObject
>
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
trendsSearchUrl
,
JSONObject
.
class
,
limit
,
page
,
type
,
word
);
JSONObject
body
=
jsonObjectResponseEntity
.
getBody
();
JSONObject
result
=
jsonObjectResponseEntity
.
getBody
();
if
(
Objects
.
nonNull
(
body
)){
if
(
Objects
.
nonNull
(
result
)){
return
ResponseResult
.
success
(
body
);
return
ResponseResult
.
success
(
result
);
}
else
{
}
else
{
return
ResponseResult
.
failure
(
"响应超时"
);
return
ResponseResult
.
failure
(
"响应超时"
);
}
}
...
@@ -63,8 +63,8 @@ public class AppSearchController {
...
@@ -63,8 +63,8 @@ public class AppSearchController {
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"3"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"3"
)
Integer
pageSize
,
@RequestParam
(
"keyword"
)
String
keyword
){
@RequestParam
(
"keyword"
)
String
keyword
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisSearchUrl
,
String
.
class
,
page
,
pageSize
,
keyword
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisSearchUrl
,
String
.
class
,
page
,
pageSize
,
keyword
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
Object
result
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
return
ResponseResult
.
success
(
result
);
}
}
@ApiOperation
(
"搜索-全网事件库-查事件"
)
@ApiOperation
(
"搜索-全网事件库-查事件"
)
...
@@ -73,7 +73,7 @@ public class AppSearchController {
...
@@ -73,7 +73,7 @@ public class AppSearchController {
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
){
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
){
String
name
=
keyword
.
trim
();
String
name
=
keyword
.
trim
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getEfSearchUrl
,
String
.
class
,
name
,
page
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getEfSearchUrl
,
String
.
class
,
name
,
page
);
JSONObject
jsonObjec
t
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
JSONObject
resul
t
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
return
ResponseResult
.
success
(
jsonObjec
t
);
return
ResponseResult
.
success
(
resul
t
);
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
View file @
628bd882
...
@@ -92,7 +92,7 @@ public class EsQueryTools {
...
@@ -92,7 +92,7 @@ public class EsQueryTools {
public
static
BoolQueryBuilder
assembleMediaTypeQuery
(
List
<
String
>
mediaTypes
)
{
public
static
BoolQueryBuilder
assembleMediaTypeQuery
(
List
<
String
>
mediaTypes
)
{
BoolQueryBuilder
tagQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
tagQuery
=
QueryBuilders
.
boolQuery
();
mediaTypes
.
forEach
(
e
->
{
mediaTypes
.
forEach
(
e
->
{
tagQuery
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_
mark_
cache_maps.channel_type.keyword"
,
e
));
tagQuery
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.channel_type.keyword"
,
e
));
});
});
return
tagQuery
;
return
tagQuery
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
628bd882
...
@@ -6,9 +6,11 @@ import com.zhiwei.brandkbs2.pojo.Event;
...
@@ -6,9 +6,11 @@ import com.zhiwei.brandkbs2.pojo.Event;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.commons.lang3.tuple.Pair
;
import
javax.naming.directory.SearchControls
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -166,10 +168,10 @@ public interface MarkDataService {
...
@@ -166,10 +168,10 @@ public interface MarkDataService {
/**
/**
* 竞品库-获取搜索条件
* 竞品库-获取搜索条件
*
*
* @param
linkedGroupId 关联组
Id
* @param
contendId 竞品
Id
* @return 搜索条件
* @return 搜索条件
*/
*/
JSONObject
getContendSearchCriteria
(
String
linkedGroup
Id
);
JSONObject
getContendSearchCriteria
(
String
contend
Id
);
/**
/**
* 竞品库-获取搜索结果列表
* 竞品库-获取搜索结果列表
...
@@ -200,6 +202,20 @@ public interface MarkDataService {
...
@@ -200,6 +202,20 @@ public interface MarkDataService {
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
;
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
;
/**
/**
* 竞品库-舆情导出
* @param markSearchDTO 标注数据搜索传输类
* @return
*/
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
downloadContendMarkList
(
MarkSearchDTO
markSearchDTO
);
/**
* 搜索-全网搜
* @param searchFilterDTO
* @return
*/
JSONObject
searchWholeNetwork
(
SearchFilterDTO
searchFilterDTO
);
/**
* 时间段内稿件数
* 时间段内稿件数
*
*
* @param startTime
* @param startTime
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
628bd882
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
...
@@ -59,8 +60,10 @@ import org.elasticsearch.search.sort.SortBuilders;
...
@@ -59,8 +60,10 @@ import org.elasticsearch.search.sort.SortBuilders;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.joda.time.Period
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -83,6 +86,9 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -83,6 +86,9 @@ public class MarkDataServiceImpl implements MarkDataService {
private
static
final
String
[]
EVENT_FETCH_SOURCE
=
new
String
[]{
"id"
,
"ind_full_text"
,
"c5"
,
"real_source"
,
"source"
,
"mtime"
,
"time"
,
"url"
,
"mtag"
,
"foreign"
,
"brandkbs_mark_cache_maps"
};
private
static
final
String
[]
EVENT_FETCH_SOURCE
=
new
String
[]{
"id"
,
"ind_full_text"
,
"c5"
,
"real_source"
,
"source"
,
"mtime"
,
"time"
,
"url"
,
"mtag"
,
"foreign"
,
"brandkbs_mark_cache_maps"
};
@Value
(
"${istarshine.addIStarShineKSData.url}"
)
private
String
addIStarShineKSDataUrl
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
private
ProjectService
projectService
;
...
@@ -854,18 +860,16 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -854,18 +860,16 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
@Override
@Override
public
JSONObject
getContendSearchCriteria
(
String
linkedGroup
Id
)
{
public
JSONObject
getContendSearchCriteria
(
String
contend
Id
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
if
(
null
==
linkedGroupId
)
{
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
}
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
// 搜索时间
// 搜索时间
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
// 平台
// 平台
result
.
put
(
"platformList"
,
commonService
.
getQbjcPlatform
(
"id"
,
"name"
));
result
.
put
(
"platformList"
,
commonService
.
getQbjcPlatform
(
"id"
,
"name"
));
// 情感标签
// 情感标签
result
.
put
(
"emotionList"
,
commonService
.
getEmotionTagsWithSort
(
projectId
,
linkedGroupId
).
stream
().
map
(
markerTag
->
{
String
contendLinkedGroupId
=
projectService
.
getProjectByContendId
(
projectId
,
contendId
).
getBrandLinkedGroupId
();
result
.
put
(
"emotionList"
,
commonService
.
getEmotionTagsWithSort
(
projectId
,
contendLinkedGroupId
).
stream
().
map
(
markerTag
->
{
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"uniqueId"
,
markerTag
.
getUniqueId
());
json
.
put
(
"uniqueId"
,
markerTag
.
getUniqueId
());
json
.
put
(
"name"
,
markerTag
.
getName
());
json
.
put
(
"name"
,
markerTag
.
getName
());
...
@@ -874,17 +878,13 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -874,17 +878,13 @@ public class MarkDataServiceImpl implements MarkDataService {
// 重要发声方
// 重要发声方
result
.
put
(
"mediaTypeList"
,
ImportantChannelEnum
.
getAllTagExceptSpec
());
result
.
put
(
"mediaTypeList"
,
ImportantChannelEnum
.
getAllTagExceptSpec
());
// 竞品品牌
// 竞品品牌
Project
project
=
projectService
.
getProject
ById
(
projectId
);
Project
VO
project
=
projectService
.
getProjectVO
ById
(
projectId
);
List
<
JSONObject
>
contendNameList
=
project
.
getContendList
().
stream
().
map
(
contend
->
{
List
<
JSONObject
>
contendNameList
=
project
.
getContendList
().
stream
().
map
(
contend
->
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"contendName"
,
contend
.
getBrandName
());
jsonObject
.
put
(
"contendName"
,
contend
.
getBrandName
());
jsonObject
.
put
(
"contendId"
,
contend
.
getId
());
jsonObject
.
put
(
"contendId"
,
contend
.
getId
());
return
jsonObject
;
return
jsonObject
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
JSONObject
allContend
=
new
JSONObject
();
allContend
.
put
(
"contendName"
,
"全部"
);
allContend
.
put
(
"contendId"
,
"-1"
);
contendNameList
.
add
(
0
,
allContend
);
result
.
put
(
"contendNameList"
,
contendNameList
);
result
.
put
(
"contendNameList"
,
contendNameList
);
// 其他标签组(筛选器)
// 其他标签组(筛选器)
result
.
put
(
"tagFilterList"
,
tagFilterService
.
getTagFilter
());
result
.
put
(
"tagFilterList"
,
tagFilterService
.
getTagFilter
());
...
@@ -920,9 +920,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -920,9 +920,8 @@ public class MarkDataServiceImpl implements MarkDataService {
private
Pair
<
SearchHits
[],
Map
<
String
,
Long
>>
searchContendMarkHitsAndCount
(
MarkSearchDTO
dto
,
boolean
aggree
)
throws
IOException
{
private
Pair
<
SearchHits
[],
Map
<
String
,
Long
>>
searchContendMarkHitsAndCount
(
MarkSearchDTO
dto
,
boolean
aggree
)
throws
IOException
{
EsClientDao
.
SearchHelper
helper
=
createContendSearchHelper
(
dto
);
EsClientDao
.
SearchHelper
helper
=
createContendSearchHelper
(
dto
);
if
(
aggree
)
{
if
(
aggree
)
{
// TODO 本地调试不滚动查询
List
<
SearchResponse
>
searchResponses
=
esClientDao
.
searchScrollResponse
(
helper
);
// List<SearchResponse> searchResponses = esClientDao.searchScrollResponse(helper);
// <SearchResponse> searchResponses = Collections.singletonList(esClientDao.searchResponse(helper));
List
<
SearchResponse
>
searchResponses
=
Collections
.
singletonList
(
esClientDao
.
searchResponse
(
helper
));
return
Pair
.
of
(
searchResponses
.
stream
().
map
(
SearchResponse:
:
getHits
).
toArray
(
SearchHits
[]::
new
),
null
);
return
Pair
.
of
(
searchResponses
.
stream
().
map
(
SearchResponse:
:
getHits
).
toArray
(
SearchHits
[]::
new
),
null
);
}
}
SearchHits
searchHits
=
esClientDao
.
searchHits
(
helper
);
SearchHits
searchHits
=
esClientDao
.
searchHits
(
helper
);
...
@@ -930,7 +929,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -930,7 +929,8 @@ public class MarkDataServiceImpl implements MarkDataService {
Map
<
String
,
Long
>
counts
=
new
HashMap
<>();
Map
<
String
,
Long
>
counts
=
new
HashMap
<>();
if
(
1
==
dto
.
getPage
()
&&
CollectionUtils
.
isEmpty
(
dto
.
getPlatforms
()))
{
if
(
1
==
dto
.
getPage
()
&&
CollectionUtils
.
isEmpty
(
dto
.
getPlatforms
()))
{
for
(
MessagePlatform
platform
:
GlobalPojo
.
PLATFORMS
)
{
for
(
MessagePlatform
platform
:
GlobalPojo
.
PLATFORMS
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
().
must
(
helper
.
getPostFilter
()).
must
(
EsQueryTools
.
assemblePlatformQuery
(
Collections
.
singletonList
(
platform
)));
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
().
must
(
helper
.
getPostFilter
())
.
must
(
EsQueryTools
.
assemblePlatformQuery
(
Collections
.
singletonList
(
platform
)));
Long
count
=
esClientDao
.
count
(
esClientDao
.
getIndexes
(),
queryBuilder
,
null
);
Long
count
=
esClientDao
.
count
(
esClientDao
.
getIndexes
(),
queryBuilder
,
null
);
counts
.
put
(
platform
.
getName
(),
count
);
counts
.
put
(
platform
.
getName
(),
count
);
}
}
...
@@ -942,17 +942,11 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -942,17 +942,11 @@ public class MarkDataServiceImpl implements MarkDataService {
EsClientDao
.
SearchHelper
helper
=
EsClientDao
.
createSearchHelper
();
EsClientDao
.
SearchHelper
helper
=
EsClientDao
.
createSearchHelper
();
// linkedGroupId、projectId、contendId
// linkedGroupId、projectId、contendId
String
projectId
=
dto
.
getProjectId
();
String
projectId
=
dto
.
getProjectId
();
String
linkedGroupId
=
dto
.
getLinkedGroupId
();
String
contendId
=
dto
.
getContendId
();
String
contendId
=
dto
.
getContendId
();
List
<
String
>
contendIdList
=
projectService
.
getProjectById
(
projectId
).
getContendList
().
stream
().
map
(
AbstractBaseMongo:
:
getId
).
collect
(
Collectors
.
toList
());
String
contendLinkedGroupId
=
projectService
.
getProjectByContendId
(
projectId
,
dto
.
getContendId
()).
getBrandLinkedGroupId
();
// PostFilter 后置过滤器 time
// PostFilter 后置过滤器
BoolQueryBuilder
postFilter
;
BoolQueryBuilder
postFilter
=
projectLinkedGroupContendIdQuery
(
projectId
,
contendLinkedGroupId
,
contendId
);
if
(
"-1"
.
equals
(
contendId
)
&&
CollectionUtils
.
isNotEmpty
(
contendIdList
))
{
// time
postFilter
=
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.key.keyword"
,
Tools
.
concat
(
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
)));
}
else
{
postFilter
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
}
//time
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
dto
.
getTimeType
()).
gte
(
dto
.
getStartTime
()).
lt
(
dto
.
getEndTime
()));
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
dto
.
getTimeType
()).
gte
(
dto
.
getStartTime
()).
lt
(
dto
.
getEndTime
()));
// platform
// platform
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getPlatforms
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getPlatforms
()))
{
...
@@ -1033,7 +1027,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1033,7 +1027,8 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"days"
,
new
Period
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
PeriodType
.
days
()).
getDays
());
result
.
put
(
"days"
,
new
Period
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
PeriodType
.
days
()).
getDays
());
result
.
put
(
"priName"
,
project
.
getBrandName
());
result
.
put
(
"priName"
,
project
.
getBrandName
());
// 获取时间段主品牌在每个平台传播量占比
// 获取时间段主品牌在每个平台传播量占比
List
<
JSONObject
>
primaryPlatformsProportion
=
getMarkPlatformProportion
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
true
);
List
<
JSONObject
>
primaryPlatformsProportion
=
getMarkPlatformProportion
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
true
);
// 获取时间段主品牌总传播量
// 获取时间段主品牌总传播量
long
primaryTotalCount
=
primaryPlatformsProportion
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
long
primaryTotalCount
=
primaryPlatformsProportion
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
result
.
put
(
"priNorTotal"
,
primaryTotalCount
);
result
.
put
(
"priNorTotal"
,
primaryTotalCount
);
...
@@ -1042,11 +1037,12 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1042,11 +1037,12 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"priMaxPlatform"
,
primaryMaxPlatformProportion
.
getString
(
"platform"
));
result
.
put
(
"priMaxPlatform"
,
primaryMaxPlatformProportion
.
getString
(
"platform"
));
result
.
put
(
"priMaxPlatformPro"
,
primaryMaxPlatformProportion
.
getDoubleValue
(
"proportion"
));
result
.
put
(
"priMaxPlatformPro"
,
primaryMaxPlatformProportion
.
getDoubleValue
(
"proportion"
));
// 竞品的名字
// 竞品的名字
AbstractProject
projectByContendId
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
());
String
brandName
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
()).
getBrandName
();
String
brandName
=
projectByContendId
.
getBrandName
();
result
.
put
(
"conName"
,
brandName
);
result
.
put
(
"conName"
,
brandName
);
// 获取时间段竞品在每个平台传播量
// 获取时间段竞品在每个平台传播量
List
<
JSONObject
>
contendPlatformsProportion
=
getMarkPlatformProportion
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
(),
true
);
String
contendLinkedGroupId
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
()).
getBrandLinkedGroupId
();
List
<
JSONObject
>
contendPlatformsProportion
=
getMarkPlatformProportion
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
(),
true
);
// 获取时间段竞品总传播量
// 获取时间段竞品总传播量
long
contendTotalCount
=
contendPlatformsProportion
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
long
contendTotalCount
=
contendPlatformsProportion
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
result
.
put
(
"conNorTotal"
,
contendTotalCount
);
result
.
put
(
"conNorTotal"
,
contendTotalCount
);
...
@@ -1073,6 +1069,7 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1073,6 +1069,7 @@ public class MarkDataServiceImpl implements MarkDataService {
// 竞品的名字
// 竞品的名字
AbstractProject
projectByContendId
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
());
AbstractProject
projectByContendId
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
());
String
brandName
=
projectByContendId
.
getBrandName
();
String
brandName
=
projectByContendId
.
getBrandName
();
String
contendLinkedGroupId
=
projectByContendId
.
getBrandLinkedGroupId
();
// 缓存
// 缓存
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
Constant
.
DAY_PATTERN
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
Constant
.
DAY_PATTERN
);
String
startTimeStr
=
sdf
.
format
(
dto
.
getStartTime
());
String
startTimeStr
=
sdf
.
format
(
dto
.
getStartTime
());
...
@@ -1095,7 +1092,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1095,7 +1092,8 @@ public class MarkDataServiceImpl implements MarkDataService {
JSONObject
primaryLine
=
new
JSONObject
();
JSONObject
primaryLine
=
new
JSONObject
();
primaryLine
.
put
(
"id"
,
Constant
.
PRIMARY_CONTEND_ID
);
primaryLine
.
put
(
"id"
,
Constant
.
PRIMARY_CONTEND_ID
);
primaryLine
.
put
(
"brand"
,
project
.
getBrandName
());
primaryLine
.
put
(
"brand"
,
project
.
getBrandName
());
List
<
JSONObject
>
primarySpread
=
getDayMarkArticleCount
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
List
<
JSONObject
>
primarySpread
=
getDayMarkArticleCount
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
primaryLine
.
put
(
"spread"
,
primarySpread
);
primaryLine
.
put
(
"spread"
,
primarySpread
);
resList
.
add
(
primaryLine
);
resList
.
add
(
primaryLine
);
result
.
put
(
"days"
,
primarySpread
.
size
());
result
.
put
(
"days"
,
primarySpread
.
size
());
...
@@ -1104,7 +1102,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1104,7 +1102,8 @@ public class MarkDataServiceImpl implements MarkDataService {
JSONObject
contendLine
=
new
JSONObject
();
JSONObject
contendLine
=
new
JSONObject
();
contendLine
.
put
(
"id"
,
dto
.
getContendId
());
contendLine
.
put
(
"id"
,
dto
.
getContendId
());
contendLine
.
put
(
"brand"
,
brandName
);
contendLine
.
put
(
"brand"
,
brandName
);
List
<
JSONObject
>
contendSpread
=
getDayMarkArticleCount
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
());
List
<
JSONObject
>
contendSpread
=
getDayMarkArticleCount
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
());
contendLine
.
put
(
"spread"
,
contendSpread
);
contendLine
.
put
(
"spread"
,
contendSpread
);
resList
.
add
(
contendLine
);
resList
.
add
(
contendLine
);
result
.
put
(
"spread"
,
resList
);
result
.
put
(
"spread"
,
resList
);
...
@@ -1124,20 +1123,24 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1124,20 +1123,24 @@ public class MarkDataServiceImpl implements MarkDataService {
long
priMaxDayStartTime
=
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
));
long
priMaxDayStartTime
=
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
));
long
priMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
))),
1
).
getTime
();
long
priMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
))),
1
).
getTime
();
// 获取时间段某情感数据最多的标题
// 获取时间段某情感数据最多的标题
List
<
Map
.
Entry
<
String
,
Integer
>>
priTopTitle
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
1
);
List
<
Map
.
Entry
<
String
,
Integer
>>
priTopTitle
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
priTopTitle
))
{
if
(
CollectionUtils
.
isNotEmpty
(
priTopTitle
))
{
// 首发稿件
// 首发稿件
BaseMap
priFirstArticle
=
getFirstArticle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
priTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
BaseMap
priFirstArticle
=
getFirstArticle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
priTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
result
.
put
(
"priTopTitle"
,
priFirstArticle
.
getTitle
());
result
.
put
(
"priTopTitle"
,
priFirstArticle
.
getTitle
());
result
.
put
(
"priTopTitleUrl"
,
priFirstArticle
.
getUrl
());
result
.
put
(
"priTopTitleUrl"
,
priFirstArticle
.
getUrl
());
}
}
// 获取主品牌热门媒体方向
// 获取主品牌热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
priHotTitles
))
{
if
(
CollectionUtils
.
isNotEmpty
(
priHotTitles
))
{
List
<
JSONObject
>
priHotArticle
=
priHotTitles
.
stream
().
map
(
map
->
{
List
<
JSONObject
>
priHotArticle
=
priHotTitles
.
stream
().
map
(
map
->
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
BaseMap
priFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
BaseMap
priFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
if
(
null
!=
priFirstArticle
)
{
if
(
null
!=
priFirstArticle
)
{
jsonObject
.
put
(
"title"
,
priFirstArticle
.
getTitle
());
jsonObject
.
put
(
"title"
,
priFirstArticle
.
getTitle
());
jsonObject
.
put
(
"url"
,
priFirstArticle
.
getUrl
());
jsonObject
.
put
(
"url"
,
priFirstArticle
.
getUrl
());
...
@@ -1166,21 +1169,25 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1166,21 +1169,25 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"conMaxCount"
,
contendMax
.
getLongValue
(
"count"
));
result
.
put
(
"conMaxCount"
,
contendMax
.
getLongValue
(
"count"
));
long
conMaxDayStartTime
=
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
));
long
conMaxDayStartTime
=
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
));
long
conMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
))),
1
).
getTime
();
long
conMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
Long
.
parseLong
(
primaryMax
.
getString
(
"date"
))),
1
).
getTime
();
List
<
Map
.
Entry
<
String
,
Integer
>>
conTopTitle
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
(),
1
);
List
<
Map
.
Entry
<
String
,
Integer
>>
conTopTitle
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
(),
1
);
if
(
CollectionUtils
.
isNotEmpty
(
conTopTitle
))
{
if
(
CollectionUtils
.
isNotEmpty
(
conTopTitle
))
{
// 首发稿件
// 首发稿件
BaseMap
conFirstArticle
=
getFirstArticle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
conTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
());
BaseMap
conFirstArticle
=
getFirstArticle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
conTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
());
result
.
put
(
"conTopTitle"
,
conFirstArticle
.
getTitle
());
result
.
put
(
"conTopTitle"
,
conFirstArticle
.
getTitle
());
result
.
put
(
"conTopTitleUrl"
,
conFirstArticle
.
getUrl
());
result
.
put
(
"conTopTitleUrl"
,
conFirstArticle
.
getUrl
());
}
}
// 获取竞品热门媒体方向
// 获取竞品热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
(),
hotArticleSize
);
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
(),
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
conHotTitles
))
{
if
(
CollectionUtils
.
isNotEmpty
(
conHotTitles
))
{
List
<
JSONObject
>
conHotArticle
=
conHotTitles
.
stream
().
map
(
map
->
{
List
<
JSONObject
>
conHotArticle
=
conHotTitles
.
stream
().
map
(
map
->
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
BaseMap
conFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
dto
.
getContendId
());
BaseMap
conFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
());
if
(
null
!=
conFirstArticle
)
{
if
(
null
!=
conFirstArticle
)
{
jsonObject
.
put
(
"title"
,
conFirstArticle
.
getTitle
());
jsonObject
.
put
(
"title"
,
conFirstArticle
.
getTitle
());
jsonObject
.
put
(
"url"
,
conFirstArticle
.
getUrl
());
jsonObject
.
put
(
"url"
,
conFirstArticle
.
getUrl
());
...
@@ -1198,6 +1205,67 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1198,6 +1205,67 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
@Override
@Override
public
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
downloadContendMarkList
(
MarkSearchDTO
markSearchDTO
)
{
try
{
ProjectVO
project
=
projectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
());
List
<
ExportAppYuqingDTO
>
returnList
=
new
ArrayList
<>();
defaultMarkSearch
(
markSearchDTO
);
Pair
<
SearchHits
[],
Map
<
String
,
Long
>>
hitsAndCounts
=
searchContendMarkHitsAndCount
(
markSearchDTO
,
false
);
for
(
SearchHits
searchHits
:
hitsAndCounts
.
getLeft
())
{
List
<
ExportAppYuqingDTO
>
collect
=
Arrays
.
stream
(
searchHits
.
getHits
()).
map
(
SearchHit:
:
getSourceAsMap
).
map
(
ExportAppYuqingDTO:
:
createFromEsMap
).
collect
(
Collectors
.
toList
());
returnList
.
addAll
(
collect
);
}
return
Pair
.
of
(
project
.
getBrandName
()
+
"_"
+
markSearchDTO
.
getStartTime
()
+
"_"
+
markSearchDTO
.
getEndTime
(),
returnList
);
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es检索异常"
));
}
return
null
;
}
@Override
public
JSONObject
searchWholeNetwork
(
SearchFilterDTO
dto
)
{
// Project project = projectService.getProjectById(dto.getProjectId());
// if (1 == project.getWholeSearchDataSource()){
// defaultSearchFilter(dto);
// try {
// JSONObject params = IstarShineUtil.getKSSearchParam(keyword, null, dto.getStartTime(), dto.getEndTime(), platforms,
// filterForward, sortOf, dto.getPage(), dto.getPageSize(), matchFields,null,null);
//
// JSONObject taskEntity = new JSONObject();
//
// taskEntity.put("appId", "6183571e0d710000f6003a12"); //应用id,由张志伟提供给使用者
// taskEntity.put("taskType", ""); //可为null, 任务类型
// taskEntity.put("taskDescription", ""); //可为null, 任务描述
// taskEntity.put("userName", "品见"); //提交任务的人
// taskEntity.put("searchParams", params); //任务详情参数
//
// ResponseEntity<JSONObject> entity = restTemplate.postForEntity(url, taskEntity, JSONObject.class);
// JSONObject result = entity.getBody().getJSONObject("data");
// return searchWholeBackUp(result.get("id").toString());
// }
// }
return
null
;
//TODO
}
private
void
defaultSearchFilter
(
SearchFilterDTO
dto
){
String
projectId
=
UserThreadLocal
.
getProjectId
();
dto
.
setProjectId
(
projectId
);
// 平台为空时,传全部
if
(
dto
.
getPlatforms
().
size
()
==
0
){
dto
.
setPlatforms
(
Arrays
.
asList
(
"微博"
,
"微信"
,
"新闻"
,
"平媒"
,
"自媒体"
,
"论坛"
,
"视频"
,
"短视频"
));
}
// 平台
dto
.
setPlatformsStr
(
StringUtils
.
join
(
dto
.
getPlatforms
(),
","
));
//平台
// sort
dto
.
setSortOf
(
"ctime+"
+
dto
.
getSorter
());
// matchFields
if
(
dto
.
getMatchType
().
equals
(
"标题"
)){
dto
.
setMatchFields
(
"title"
);
}
}
@Override
public
long
getYuqingMarkCount
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
throws
IOException
{
public
long
getYuqingMarkCount
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
)
throws
IOException
{
return
getYuqingMarkCount
(
startTime
,
endTime
,
emotion
,
null
,
projectId
,
contendId
);
return
getYuqingMarkCount
(
startTime
,
endTime
,
emotion
,
null
,
projectId
,
contendId
);
}
}
...
@@ -1416,7 +1484,7 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1416,7 +1484,7 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
boolean
cache
)
throws
IOException
{
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
boolean
cache
)
throws
IOException
{
String
redisKey
=
RedisKeyPrefix
.
MARK_PLATFORM_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_PLATFORM_PROPORTION
+
Tools
.
concat
(
projectId
,
contendId
,
startTime
,
endTime
);
String
resultStr
;
String
resultStr
;
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
...
...
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