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
37d2b9c8
Commit
37d2b9c8
authored
Sep 07, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
Feature See merge request
!33
parents
1c1bad6b
94eefc30
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
300 additions
and
36 deletions
+300
-36
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+6
-5
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+48
-9
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ExportSearchWholeDTO.java
+51
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/SearchFilterDTO.java
+3
-4
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+47
-5
src/main/java/com/zhiwei/brandkbs2/service/SystemInfoService.java
+7
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+88
-6
src/main/java/com/zhiwei/brandkbs2/service/impl/SystemInfoServiceImpl.java
+23
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+4
-2
src/main/resources/application-local.properties
+5
-3
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
View file @
37d2b9c8
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.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.BaseMap
;
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.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
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
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @ClassName AppContendController
* @ClassName AppContendController
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
37d2b9c8
...
@@ -116,30 +116,31 @@ public class AppHotController extends BaseController {
...
@@ -116,30 +116,31 @@ public class AppHotController extends BaseController {
}
}
}
}
@ApiOperation
(
"
热点
库-最新资讯"
)
@ApiOperation
(
"
竞品
库-最新资讯"
)
@GetMapping
(
"/latestNews"
)
@GetMapping
(
"/latestNews"
)
public
ResponseResult
latestNews
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"5"
)
Integer
size
)
throws
IOException
{
public
ResponseResult
latestNews
(
@RequestParam
(
value
=
"size"
,
defaultValue
=
"5"
)
Integer
size
,
@RequestParam
(
value
=
"include"
,
defaultValue
=
"true"
)
boolean
include
)
throws
IOException
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
Date
endDate
=
new
Date
();
Date
endDate
=
new
Date
();
Date
startDate
=
DateUtils
.
addHours
(
endDate
,
-
24
);
Date
startDate
=
DateUtils
.
addHours
(
endDate
,
-
24
);
List
<
Map
.
Entry
<
String
,
Integer
>>
markTopTitleList
=
List
<
Map
.
Entry
<
String
,
Integer
>>
markTopTitleList
=
markDataService
.
getMarkTopTitle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
null
,
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
,
siz
e
);
markDataService
.
getMarkTopTitle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
null
,
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
,
size
,
includ
e
);
List
<
JSONObject
>
resultList
=
markTopTitleList
.
stream
().
map
(
map
->
{
List
<
JSONObject
>
resultList
=
markTopTitleList
.
stream
().
map
(
map
->
{
JSONObject
resultJsonObject
=
new
JSONObject
();
JSONObject
resultJsonObject
=
new
JSONObject
();
resultJsonObject
.
put
(
"title"
,
map
.
getKey
());
resultJsonObject
.
put
(
"title"
,
map
.
getKey
());
resultJsonObject
.
put
(
"num"
,
map
.
getValue
());
resultJsonObject
.
put
(
"num"
,
map
.
getValue
());
try
{
try
{
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
map
.
getKey
(),
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
);
BaseMap
firstArticle
=
markDataService
.
getFirstArticle
(
startDate
.
getTime
(),
endDate
.
getTime
(),
map
.
getKey
(),
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
,
include
);
resultJsonObject
.
put
(
"content"
,
firstArticle
.
getContent
());
resultJsonObject
.
put
(
"content"
,
firstArticle
.
getContent
());
resultJsonObject
.
put
(
"url"
,
firstArticle
.
getUrl
());
resultJsonObject
.
put
(
"url"
,
firstArticle
.
getUrl
());
resultJsonObject
.
put
(
"realSource"
,
firstArticle
.
getRealSource
());
resultJsonObject
.
put
(
"realSource"
,
firstArticle
.
getRealSource
());
}
catch
(
IOException
ignored
)
{
}
catch
(
IOException
ignored
)
{
}
}
return
resultJsonObject
;
return
resultJsonObject
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
return
ResponseResult
.
success
(
resultList
);
return
ResponseResult
.
success
(
resultList
);
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
37d2b9c8
...
@@ -5,15 +5,15 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,15 +5,15 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
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.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportSearchWholeDTO
;
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.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -41,7 +41,7 @@ import java.util.Objects;
...
@@ -41,7 +41,7 @@ import java.util.Objects;
@RequestMapping
(
"/app/search"
)
@RequestMapping
(
"/app/search"
)
@Api
(
tags
=
"前台搜索相关接口"
,
description
=
"提供搜索相关功能"
)
@Api
(
tags
=
"前台搜索相关接口"
,
description
=
"提供搜索相关功能"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppSearchController
{
public
class
AppSearchController
extends
BaseController
{
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
...
@@ -51,6 +51,9 @@ public class AppSearchController {
...
@@ -51,6 +51,9 @@ public class AppSearchController {
@Value
(
"${crisis.search.url}"
)
@Value
(
"${crisis.search.url}"
)
private
String
crisisSearchUrl
;
private
String
crisisSearchUrl
;
@Value
(
"${crisis.searchTags.url}"
)
private
String
crisisTagsUrl
;
@Value
(
"${ef.search.url}"
)
@Value
(
"${ef.search.url}"
)
private
String
getEfSearchUrl
;
private
String
getEfSearchUrl
;
...
@@ -60,6 +63,9 @@ public class AppSearchController {
...
@@ -60,6 +63,9 @@ public class AppSearchController {
@Resource
(
name
=
"channelServiceImpl"
)
@Resource
(
name
=
"channelServiceImpl"
)
ChannelService
channelService
;
ChannelService
channelService
;
@Resource
(
name
=
"systemInfoServiceImpl"
)
SystemInfoService
systemInfoService
;
@Resource
(
name
=
"eventServiceImpl"
)
@Resource
(
name
=
"eventServiceImpl"
)
EventService
eventService
;
EventService
eventService
;
...
@@ -91,18 +97,38 @@ public class AppSearchController {
...
@@ -91,18 +97,38 @@ public class AppSearchController {
return
ResponseResult
.
success
(
result
);
return
ResponseResult
.
success
(
result
);
}
}
@ApiOperation
(
"搜索-通过标签查危机"
)
@GetMapping
(
"/crisisTags"
)
public
ResponseResult
crisisTags
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
@RequestParam
(
value
=
"brand"
,
required
=
false
)
String
brand
,
@RequestParam
(
value
=
"category"
,
required
=
false
)
String
category
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisTagsUrl
,
String
.
class
,
page
,
pageSize
,
brand
,
category
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"搜索-全网事件库-查事件"
)
@ApiOperation
(
"搜索-全网事件库-查事件"
)
@GetMapping
(
"/getWholeNetworkEvents"
)
@GetMapping
(
"/getWholeNetworkEvents"
)
public
ResponseResult
getWholeNetworkEvents
(
@RequestParam
(
"keyword"
)
String
keyword
,
public
ResponseResult
getWholeNetworkEvents
(
@RequestParam
(
"keyword"
)
String
keyword
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
)
{
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
size
)
{
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
,
size
);
JSONObject
result
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
JSONObject
result
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
return
ResponseResult
.
success
(
result
);
return
ResponseResult
.
success
(
result
);
}
}
@ApiOperation
(
"搜索-全网搜条件"
)
@GetMapping
(
"/getWholeSearchCriteria"
)
public
ResponseResult
getWholeSearchCriteria
()
{
JSONObject
wholeSearchCriteria
=
markDataService
.
getWholeNetworkSearchCriteria
();
wholeSearchCriteria
.
putAll
(
systemInfoService
.
getExtraParam
());
return
ResponseResult
.
success
(
wholeSearchCriteria
);
}
@ApiOperation
(
"搜索-全网搜"
)
@ApiOperation
(
"搜索-全网搜"
)
@
Ge
tMapping
(
"/searchWhole"
)
@
Pos
tMapping
(
"/searchWhole"
)
public
ResponseResult
searchWholeNetwork
(
@RequestBody
SearchFilterDTO
dto
)
{
public
ResponseResult
searchWholeNetwork
(
@RequestBody
SearchFilterDTO
dto
)
{
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
if
(
time
>
dto
.
getStartTime
())
{
if
(
time
>
dto
.
getStartTime
())
{
...
@@ -115,7 +141,19 @@ public class AppSearchController {
...
@@ -115,7 +141,19 @@ public class AppSearchController {
return
ResponseResult
.
success
(
markDataService
.
searchWholeNetwork
(
dto
));
return
ResponseResult
.
success
(
markDataService
.
searchWholeNetwork
(
dto
));
}
}
@ApiOperation
(
"搜索-舆情列表"
)
@ApiOperation
(
"搜索-全网搜-舆情导出"
)
@PostMapping
(
"/exportSearchWhole"
)
public
ResponseResult
exportSearchWhole
(
@RequestBody
SearchFilterDTO
dto
)
{
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
if
(
time
>
dto
.
getStartTime
())
{
return
ResponseResult
.
failure
(
"仅能导出近3个月内信息"
);
}
List
<
ExportSearchWholeDTO
>
exportList
=
markDataService
.
exportSearchWhole
(
dto
);
EasyExcelUtil
.
download
(
"全网搜舆情列表数据"
,
"sheet1"
,
ExportSearchWholeDTO
.
class
,
exportList
,
response
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"舆情列表"
)
@PostMapping
(
"/mark/list"
)
@PostMapping
(
"/mark/list"
)
public
ResponseResult
getYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
public
ResponseResult
getYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
...
@@ -183,4 +221,5 @@ public class AppSearchController {
...
@@ -183,4 +221,5 @@ public class AppSearchController {
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
contendId
)
{
public
ResponseResult
getContendSearchCriteria
(
@RequestParam
(
required
=
false
)
String
contendId
)
{
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
contendId
));
return
ResponseResult
.
success
(
markDataService
.
getContendSearchCriteria
(
contendId
));
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
View file @
37d2b9c8
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.es;
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.es;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.pushlog.tools.Tools
;
import
com.zhiwei.pushlog.tools.Tools
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -109,6 +110,13 @@ public class EsQueryTools {
...
@@ -109,6 +110,13 @@ public class EsQueryTools {
return
nestedBoolQueryBuilder
;
return
nestedBoolQueryBuilder
;
}
}
public
static
BoolQueryBuilder
assembleCacheMapsQueryExcludePrimaryId
(
String
projectId
){
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
cacheMapsNestedQuery
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.project_id.keyword"
,
projectId
)));
query
.
mustNot
(
cacheMapsNestedQuery
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.contend_id.keyword"
,
Constant
.
PRIMARY_CONTEND_ID
)));
return
query
;
}
public
static
NestedQueryBuilder
cacheMapsNestedQuery
(
QueryBuilder
query
)
{
public
static
NestedQueryBuilder
cacheMapsNestedQuery
(
QueryBuilder
query
)
{
return
new
NestedQueryBuilder
(
ES_BRANDKBS_CACHE_MAPS
,
query
,
ScoreMode
.
None
);
return
new
NestedQueryBuilder
(
ES_BRANDKBS_CACHE_MAPS
,
query
,
ScoreMode
.
None
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ExportSearchWholeDTO.java
0 → 100644
View file @
37d2b9c8
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.Date
;
/**
* 全网搜舆情导出实体类
*/
@Data
@ToString
public
class
ExportSearchWholeDTO
{
@ColumnWidth
(
20
)
@ExcelProperty
(
"时间"
)
private
Date
time
;
@ColumnWidth
(
20
)
@ExcelProperty
(
"平台"
)
private
String
platform
;
@ColumnWidth
(
20
)
@ExcelProperty
(
"渠道"
)
private
String
channel
;
@ColumnWidth
(
50
)
@ExcelProperty
(
"标题"
)
private
String
title
;
@ColumnWidth
(
50
)
@ExcelProperty
(
"文本"
)
private
String
content
;
@ColumnWidth
(
50
)
@ExcelProperty
(
"地址"
)
private
String
url
;
public
static
ExportSearchWholeDTO
creatExportSearchWholeDTO
(
JSONObject
jsonObject
){
ExportSearchWholeDTO
dto
=
new
ExportSearchWholeDTO
();
dto
.
setTime
(
new
Date
((
Long
)
jsonObject
.
get
(
"time"
)));
dto
.
setPlatform
(
jsonObject
.
getString
(
"platform"
));
dto
.
setChannel
(
jsonObject
.
getString
(
"channel"
));
dto
.
setTitle
(
jsonObject
.
getString
(
"title"
));
dto
.
setContent
(
jsonObject
.
getString
(
"content"
));
dto
.
setUrl
(
jsonObject
.
getString
(
"url"
));
return
dto
;
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/dto/SearchFilterDTO.java
View file @
37d2b9c8
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -121,8 +120,8 @@ public class SearchFilterDTO {
...
@@ -121,8 +120,8 @@ public class SearchFilterDTO {
public
Map
<
String
,
Object
>
toMap
()
{
public
Map
<
String
,
Object
>
toMap
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"timeType"
,
"time"
);
map
.
put
(
"timeType"
,
"time"
);
map
.
put
(
"pt"
,
getP
t
());
map
.
put
(
"pt"
,
getP
latforms
());
map
.
put
(
"matchType"
,
matchType
);
map
.
put
(
"matchType"
,
matchType
);
map
.
put
(
"search"
,
search
);
map
.
put
(
"search"
,
search
);
map
.
put
(
"startTime"
,
startTime
);
map
.
put
(
"startTime"
,
startTime
);
...
@@ -138,7 +137,7 @@ public class SearchFilterDTO {
...
@@ -138,7 +137,7 @@ public class SearchFilterDTO {
return
map
;
return
map
;
}
}
public
List
<
String
>
getP
t
()
{
public
List
<
String
>
getP
latforms
()
{
return
Objects
.
nonNull
(
platforms
)
?
this
.
platforms
:
Collections
.
emptyList
();
return
Objects
.
nonNull
(
platforms
)
?
this
.
platforms
:
Collections
.
emptyList
();
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
37d2b9c8
...
@@ -5,6 +5,7 @@ import com.zhiwei.brandkbs2.pojo.BaseMap;
...
@@ -5,6 +5,7 @@ import com.zhiwei.brandkbs2.pojo.BaseMap;
import
com.zhiwei.brandkbs2.pojo.Event
;
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.ExportSearchWholeDTO
;
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.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
...
@@ -133,6 +134,21 @@ public interface MarkDataService {
...
@@ -133,6 +134,21 @@ public interface MarkDataService {
String
contendId
,
int
size
)
throws
IOException
;
String
contendId
,
int
size
)
throws
IOException
;
/**
/**
* 获取时间段某情感数据最多的标题
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param emotion 情感倾向名称
* @param projectId 项目id
* @param linkedGroupId 关联组id
* @param size 分页大小
* @param include 是否包含主品牌
* @return 最热标题
*/
List
<
Map
.
Entry
<
String
,
Integer
>>
getMarkTopTitle
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
int
size
,
boolean
include
)
throws
IOException
;
/**
* 根据聚合标题和时间获取首发稿件
* 根据聚合标题和时间获取首发稿件
*
*
* @param startTime 开始时间
* @param startTime 开始时间
...
@@ -145,6 +161,19 @@ public interface MarkDataService {
...
@@ -145,6 +161,19 @@ public interface MarkDataService {
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
)
throws
IOException
;
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
)
throws
IOException
;
/**
/**
* 根据聚合标题和时间获取首发稿件
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param aggTitle 聚合标题
* @param projectId 项目id
* @param linkedGroupId 关联组id
* @param include 是否包含主品牌
* @return 首发稿件
*/
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
boolean
include
)
throws
IOException
;
/**
* 搜索标注数据通过事件
* 搜索标注数据通过事件
*
*
* @param event
* @param event
...
@@ -196,7 +225,7 @@ public interface MarkDataService {
...
@@ -196,7 +225,7 @@ public interface MarkDataService {
* @param markSearchDTO 标注数据搜索传输类
* @param markSearchDTO 标注数据搜索传输类
* @param hotArticleSize 热门稿件数量
* @param hotArticleSize 热门稿件数量
* @param cache 是否启用缓存
* @param cache 是否启用缓存
* @return
* @return
JSONObject
*/
*/
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
;
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
;
...
@@ -204,17 +233,30 @@ public interface MarkDataService {
...
@@ -204,17 +233,30 @@ public interface MarkDataService {
* 竞品库-舆情导出
* 竞品库-舆情导出
*
*
* @param markSearchDTO 标注数据搜索传输类
* @param markSearchDTO 标注数据搜索传输类
* @return
* @return
Pair<String, List<ExportAppYuqingDTO>>
*/
*/
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
downloadContendMarkList
(
MarkSearchDTO
markSearchDTO
);
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
downloadContendMarkList
(
MarkSearchDTO
markSearchDTO
);
/**
/**
* 搜索-全网搜条件
* @return JSONObject
*/
JSONObject
getWholeNetworkSearchCriteria
();
/**
* 搜索-全网搜
* 搜索-全网搜
*
*
* @param searchFilterDTO
* @param dto 全网搜搜索传输类
* @return
* @return JSONObject
*/
JSONObject
searchWholeNetwork
(
SearchFilterDTO
dto
);
/**
* 搜索-全网搜-舆情导出
* @param dto 全网搜搜索传输类
* @return List<ExportSearchWholeDTO>
*/
*/
JSONObject
searchWholeNetwork
(
SearchFilterDTO
searchFilterDTO
);
List
<
ExportSearchWholeDTO
>
exportSearchWhole
(
SearchFilterDTO
dto
);
/**
/**
* 时间段内稿件数
* 时间段内稿件数
...
...
src/main/java/com/zhiwei/brandkbs2/service/SystemInfoService.java
View file @
37d2b9c8
package
com
.
zhiwei
.
brandkbs2
.
service
;
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.ChannelTag
;
import
com.zhiwei.brandkbs2.pojo.ChannelTag
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
...
@@ -38,4 +39,10 @@ public interface SystemInfoService {
...
@@ -38,4 +39,10 @@ public interface SystemInfoService {
Map
<
String
,
Map
<
String
,
String
>>
getMediaTypes
();
Map
<
String
,
Map
<
String
,
String
>>
getMediaTypes
();
/**
* 从舆情系统 获取舆情查询额外参数
* @return JSONObject
*/
JSONObject
getExtraParam
();
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
37d2b9c8
...
@@ -685,14 +685,14 @@ public class EventServiceImpl implements EventService {
...
@@ -685,14 +685,14 @@ public class EventServiceImpl implements EventService {
private
List
<
JSONObject
>
getDefaultVolumes
()
{
private
List
<
JSONObject
>
getDefaultVolumes
()
{
List
<
JSONObject
>
res
=
new
ArrayList
<>();
List
<
JSONObject
>
res
=
new
ArrayList
<>();
for
(
String
name
:
Arrays
.
asList
(
"全部"
,
"1-100"
,
"100-1000"
,
"1000-5000"
,
"
>=
5000"
))
{
for
(
String
name
:
Arrays
.
asList
(
"全部"
,
"1-100"
,
"100-1000"
,
"1000-5000"
,
"
≥
5000"
))
{
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"name"
,
name
);
json
.
put
(
"name"
,
name
);
switch
(
name
)
{
switch
(
name
)
{
case
"全部"
:
case
"全部"
:
json
.
put
(
"totalDisseminationVolumes"
,
null
);
json
.
put
(
"totalDisseminationVolumes"
,
null
);
break
;
break
;
case
"
>=
5000"
:
case
"
≥
5000"
:
json
.
put
(
"totalDisseminationVolumes"
,
new
Long
[]{
5000L
,
-
1L
});
json
.
put
(
"totalDisseminationVolumes"
,
new
Long
[]{
5000L
,
-
1L
});
break
;
break
;
default
:
default
:
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
37d2b9c8
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
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.ExportSearchWholeDTO
;
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.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
...
@@ -100,6 +101,9 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -100,6 +101,9 @@ public class MarkDataServiceImpl implements MarkDataService {
@Value
(
"${whole.search.url}"
)
@Value
(
"${whole.search.url}"
)
private
String
wholeSearchUrl
;
private
String
wholeSearchUrl
;
@Value
(
"${whole.searchCriteria.url}"
)
private
String
wholeSearchCriteriaUrl
;
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
...
@@ -782,6 +786,10 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -782,6 +786,10 @@ public class MarkDataServiceImpl implements MarkDataService {
return
lineList
;
return
lineList
;
}
}
public
List
<
Map
.
Entry
<
String
,
Integer
>>
getMarkTopTitle
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
int
size
)
throws
IOException
{
return
getMarkTopTitle
(
startTime
,
endTime
,
emotion
,
projectId
,
linkedGroupId
,
contendId
,
size
,
true
);
}
/**
/**
* 获取时间段某情感数据最多的标题
* 获取时间段某情感数据最多的标题
*
*
...
@@ -791,9 +799,10 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -791,9 +799,10 @@ public class MarkDataServiceImpl implements MarkDataService {
* @param projectId 项目id
* @param projectId 项目id
* @param linkedGroupId 关联组id
* @param linkedGroupId 关联组id
* @param size 分页大小
* @param size 分页大小
* @param include 是否包含主品牌
* @return 最热标题
* @return 最热标题
*/
*/
public
List
<
Map
.
Entry
<
String
,
Integer
>>
getMarkTopTitle
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
int
size
)
throws
IOException
{
public
List
<
Map
.
Entry
<
String
,
Integer
>>
getMarkTopTitle
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
int
size
,
boolean
include
)
throws
IOException
{
// 索引
// 索引
String
[]
indexes
=
esClientDao
.
getIndexes
();
String
[]
indexes
=
esClientDao
.
getIndexes
();
// TODO script使用
// TODO script使用
...
@@ -801,7 +810,12 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -801,7 +810,12 @@ public class MarkDataServiceImpl implements MarkDataService {
// TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("titles").script(script).order(BucketOrder.count(false)).size(60000);
// TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("titles").script(script).order(BucketOrder.count(false)).size(60000);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"titles"
).
field
(
"agg_title.keyword"
).
size
(
size
*
10
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"titles"
).
field
(
"agg_title.keyword"
).
size
(
size
*
10
);
// query
// query
BoolQueryBuilder
query
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
BoolQueryBuilder
query
;
if
(
include
)
{
query
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
}
else
{
query
=
EsQueryTools
.
assembleCacheMapsQueryExcludePrimaryId
(
projectId
);
}
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
))
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
))
// 过滤微博
// 过滤微博
.
mustNot
(
QueryBuilders
.
termQuery
(
"platform_id"
,
"5d02236e6395002a7c380b79"
));
.
mustNot
(
QueryBuilders
.
termQuery
(
"platform_id"
,
"5d02236e6395002a7c380b79"
));
...
@@ -824,12 +838,21 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -824,12 +838,21 @@ public class MarkDataServiceImpl implements MarkDataService {
return
result
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
limit
(
size
).
collect
(
Collectors
.
toList
());
return
result
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
limit
(
size
).
collect
(
Collectors
.
toList
());
}
}
@Override
public
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
)
throws
IOException
{
public
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
)
throws
IOException
{
return
getFirstArticle
(
startTime
,
endTime
,
aggTitle
,
projectId
,
linkedGroupId
,
contendId
,
true
);
}
@Override
public
BaseMap
getFirstArticle
(
Long
startTime
,
Long
endTime
,
String
aggTitle
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
boolean
include
)
throws
IOException
{
// 索引
// 索引
String
[]
indexes
=
esClientDao
.
getIndexes
();
String
[]
indexes
=
esClientDao
.
getIndexes
();
// postFilter
// postFilter
BoolQueryBuilder
postFilter
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
BoolQueryBuilder
postFilter
;
if
(
include
)
{
postFilter
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
}
else
{
postFilter
=
EsQueryTools
.
assembleCacheMapsQueryExcludePrimaryId
(
projectId
);
}
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
)).
must
(
QueryBuilders
.
termQuery
(
"agg_title.keyword"
,
aggTitle
));
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
)).
must
(
QueryBuilders
.
termQuery
(
"agg_title.keyword"
,
aggTitle
));
//sort
//sort
FieldSortBuilder
sort
=
new
FieldSortBuilder
(
"time"
).
order
(
SortOrder
.
ASC
);
FieldSortBuilder
sort
=
new
FieldSortBuilder
(
"time"
).
order
(
SortOrder
.
ASC
);
...
@@ -1218,8 +1241,61 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1218,8 +1241,61 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
@Override
@Override
public
JSONObject
getWholeNetworkSearchCriteria
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
Project
project
=
projectService
.
getProjectById
(
projectId
);
JSONObject
result
=
new
JSONObject
();
// 搜索时间
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
result
.
put
(
"ninetyDays"
,
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
());
List
<
JSONObject
>
platformList
=
new
ArrayList
<>();
if
(
2
==
project
.
getWholeSearchDataSource
())
{
result
.
put
(
"origin"
,
"商业"
);
JSONObject
backUpPlatform
=
getBackUpPlatform
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
backUpPlatform
.
entrySet
())
{
JSONObject
platformJSONObject
=
new
JSONObject
();
platformJSONObject
.
put
(
"name"
,
entry
.
getKey
());
platformJSONObject
.
put
(
"id"
,
entry
.
getValue
());
platformList
.
add
(
platformJSONObject
);
}
}
else
{
result
.
put
(
"origin"
,
"舆情"
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
wholeSearchCriteriaUrl
,
String
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
Map
data
=
(
Map
)
jsonObject
.
get
(
"data"
);
List
<
JSONObject
>
list
=
(
List
)
data
.
get
(
"list"
);
//发布平台删掉脉脉
List
<
JSONObject
>
collect
=
list
.
stream
().
filter
(
s
->
!
s
.
get
(
"name"
).
equals
(
"脉脉"
)).
collect
(
Collectors
.
toList
());
for
(
JSONObject
object
:
collect
)
{
JSONObject
platformJSONObject
=
new
JSONObject
();
platformJSONObject
.
put
(
"name"
,
object
.
get
(
"name"
));
platformJSONObject
.
put
(
"id"
,
object
.
get
(
"id"
));
platformList
.
add
(
platformJSONObject
);
}
}
result
.
put
(
"platformList"
,
platformList
);
return
result
;
}
private
JSONObject
getBackUpPlatform
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"全部"
,
""
);
jsonObject
.
put
(
"微博"
,
"微博"
);
jsonObject
.
put
(
"微信"
,
"微信"
);
jsonObject
.
put
(
"网媒"
,
"新闻"
);
jsonObject
.
put
(
"平媒"
,
"平媒"
);
jsonObject
.
put
(
"自媒体"
,
"自媒体"
);
jsonObject
.
put
(
"贴吧论坛"
,
"论坛"
);
jsonObject
.
put
(
"视频"
,
"视频"
);
jsonObject
.
put
(
"短视频"
,
"短视频"
);
return
jsonObject
;
}
@Override
public
JSONObject
searchWholeNetwork
(
SearchFilterDTO
dto
)
{
public
JSONObject
searchWholeNetwork
(
SearchFilterDTO
dto
)
{
Project
project
=
projectService
.
getProjectById
(
dto
.
getProjectId
());
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
if
(
2
==
project
.
getWholeSearchDataSource
())
{
// 查商业数据库
if
(
2
==
project
.
getWholeSearchDataSource
())
{
// 查商业数据库
defaultSearchFilter
(
dto
);
defaultSearchFilter
(
dto
);
...
@@ -1246,6 +1322,13 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1246,6 +1322,13 @@ public class MarkDataServiceImpl implements MarkDataService {
return
jsonObject
;
return
jsonObject
;
}
}
@Override
public
List
<
ExportSearchWholeDTO
>
exportSearchWhole
(
SearchFilterDTO
dto
)
{
JSONObject
jsonObject
=
searchWholeNetwork
(
dto
);
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"list"
);
return
jsonArray
.
stream
().
map
(
json
->
ExportSearchWholeDTO
.
creatExportSearchWholeDTO
((
JSONObject
)
json
)).
collect
(
Collectors
.
toList
());
}
private
JSONObject
searchWholeOpinion
(
ResponseEntity
<
JSONObject
>
responseEntity
,
JSONObject
jsonObject
)
{
private
JSONObject
searchWholeOpinion
(
ResponseEntity
<
JSONObject
>
responseEntity
,
JSONObject
jsonObject
)
{
JSONObject
bodyData
=
Objects
.
requireNonNull
(
responseEntity
.
getBody
()).
getJSONObject
(
"data"
);
JSONObject
bodyData
=
Objects
.
requireNonNull
(
responseEntity
.
getBody
()).
getJSONObject
(
"data"
);
JSONObject
data
=
bodyData
.
getJSONObject
(
"data"
);
JSONObject
data
=
bodyData
.
getJSONObject
(
"data"
);
...
@@ -1257,7 +1340,6 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1257,7 +1340,6 @@ public class MarkDataServiceImpl implements MarkDataService {
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"platform"
,
list
.
get
(
"real_source"
));
result
.
put
(
"platform"
,
list
.
get
(
"real_source"
));
JSONArray
contentArray
=
list
.
getJSONArray
(
"ind_full_text"
);
JSONArray
contentArray
=
list
.
getJSONArray
(
"ind_full_text"
);
assert
contentArray
==
null
;
result
.
put
(
"title"
,
contentArray
.
get
(
0
));
result
.
put
(
"title"
,
contentArray
.
get
(
0
));
result
.
put
(
"content"
,
contentArray
.
get
(
1
));
result
.
put
(
"content"
,
contentArray
.
get
(
1
));
if
(
3
==
contentArray
.
size
())
{
if
(
3
==
contentArray
.
size
())
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/SystemInfoServiceImpl.java
View file @
37d2b9c8
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.ChannelTagDao
;
import
com.zhiwei.brandkbs2.dao.ChannelTagDao
;
import
com.zhiwei.brandkbs2.dao.MediaTypeDao
;
import
com.zhiwei.brandkbs2.dao.MediaTypeDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
...
@@ -8,12 +10,17 @@ import com.zhiwei.brandkbs2.pojo.MediaType;
...
@@ -8,12 +10,17 @@ import com.zhiwei.brandkbs2.pojo.MediaType;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
/**
/**
* @ClassName: SystemInfoServiceImpl
* @ClassName: SystemInfoServiceImpl
...
@@ -33,6 +40,12 @@ public class SystemInfoServiceImpl implements SystemInfoService {
...
@@ -33,6 +40,12 @@ public class SystemInfoServiceImpl implements SystemInfoService {
@Resource
@Resource
private
MediaTypeDao
mediaTypeDao
;
private
MediaTypeDao
mediaTypeDao
;
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${whole.extraParam.url}"
)
private
String
YU_QING_EXTRA_PARAM
;
@Override
@Override
public
List
<
MessagePlatform
>
getPlatforms
()
{
public
List
<
MessagePlatform
>
getPlatforms
()
{
return
qbjcPojoDao
.
findMessagePlatformAll
();
return
qbjcPojoDao
.
findMessagePlatformAll
();
...
@@ -58,4 +71,14 @@ public class SystemInfoServiceImpl implements SystemInfoService {
...
@@ -58,4 +71,14 @@ public class SystemInfoServiceImpl implements SystemInfoService {
}
}
return
res
;
return
res
;
}
}
@Override
public
JSONObject
getExtraParam
()
{
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
YU_QING_EXTRA_PARAM
,
String
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
forEntity
.
getBody
());
if
(
Objects
.
nonNull
(
jsonObject
)
&&
Boolean
.
TRUE
.
equals
(
jsonObject
.
getBoolean
(
"status"
)))
{
return
jsonObject
.
getJSONObject
(
"data"
);
}
return
null
;
}
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
37d2b9c8
...
@@ -100,7 +100,8 @@ public class TaskServiceImpl implements TaskService {
...
@@ -100,7 +100,8 @@ public class TaskServiceImpl implements TaskService {
// 替换成新的记录map
// 替换成新的记录map
channelIndexRecordMap
=
newRecordMap
;
channelIndexRecordMap
=
newRecordMap
;
ListUtils
.
partition
(
insertList
,
1000
).
forEach
(
list
->
{
ListUtils
.
partition
(
insertList
,
1000
).
forEach
(
list
->
{
channelDao
.
insertMany
(
list
);
// TODO 2
// channelDao.insertMany(list);
});
});
log
.
info
(
"渠道统计-渠道总计-录入完毕,新增渠道{}条,更新渠道{}条"
,
insertList
.
size
(),
channelIndexRecordMap
.
size
()
-
insertList
.
size
());
log
.
info
(
"渠道统计-渠道总计-录入完毕,新增渠道{}条,更新渠道{}条"
,
insertList
.
size
(),
channelIndexRecordMap
.
size
()
-
insertList
.
size
());
// 获得单位时间内最小最大时间戳
// 获得单位时间内最小最大时间戳
...
@@ -122,7 +123,8 @@ public class TaskServiceImpl implements TaskService {
...
@@ -122,7 +123,8 @@ public class TaskServiceImpl implements TaskService {
insertList
.
add
(
channelService
.
calculateChannelEmotionIndex
(
channel
));
insertList
.
add
(
channelService
.
calculateChannelEmotionIndex
(
channel
));
}
else
{
}
else
{
channel
.
setRecord
(
entry
.
getValue
());
channel
.
setRecord
(
entry
.
getValue
());
channelDao
.
updateOne
(
channelService
.
calculateChannelEmotionIndex
(
channel
));
// TODO 2
// channelDao.updateOne(channelService.calculateChannelEmotionIndex(channel));
}
}
// 设置查询数值
// 设置查询数值
entry
.
getKey
().
setChannelInfo
(
channel
);
entry
.
getKey
().
setChannelInfo
(
channel
);
...
...
src/main/resources/application-local.properties
View file @
37d2b9c8
...
@@ -71,7 +71,7 @@ trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTr
...
@@ -71,7 +71,7 @@ trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTr
trends.findHotSearchESDataInTimeByInner.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
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.longTimeInListSearch.url
=
https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url
=
https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
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
ef.searchCriteria.url
=
https://ef.zhiweidata.com/index/getSearchKey.do
ef.filterNew.url
=
https://ef.zhiweidata.com/filterNew.do?firstType={1}&start={2}&end={3}&page={4}
ef.filterNew.url
=
https://ef.zhiweidata.com/filterNew.do?firstType={1}&start={2}&end={3}&page={4}
ef.captcha.url
=
https://ef.zhiweidata.com/captchaApi/getNewCaptcha.do.do?type=test
ef.captcha.url
=
https://ef.zhiweidata.com/captchaApi/getNewCaptcha.do.do?type=test
...
@@ -79,4 +79,6 @@ ef.checkCaptcha.url=https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id=
...
@@ -79,4 +79,6 @@ ef.checkCaptcha.url=https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id=
#\u5168\u7F51\u641C\u5916\u90E8\u63A5\u53E3
#\u5168\u7F51\u641C\u5916\u90E8\u63A5\u53E3
istarshine.addIStarShineKSData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/addIStarShineKSData
istarshine.addIStarShineKSData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/addIStarShineKSData
istarshine.getIStarShineKSInfoData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/getIStarShineKSInfoData?taskId={1}&appId=6183571e0d710000f6003a12
istarshine.getIStarShineKSInfoData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/getIStarShineKSInfoData?taskId={1}&appId=6183571e0d710000f6003a12
whole.search.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.search.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
\ No newline at end of file
whole.searchCriteria.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
\ No newline at end of file
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