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
881e33a0
Commit
881e33a0
authored
Aug 26, 2022
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全网搜
parent
40629424
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
12 deletions
+100
-12
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
+27
-4
src/main/java/com/zhiwei/brandkbs2/pojo/dto/SearchFilterDTO.java
+67
-6
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+0
-0
src/main/resources/application-local.properties
+6
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppSearchController.java
View file @
881e33a0
...
...
@@ -4,19 +4,25 @@ package com.zhiwei.brandkbs2.controller.app;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.Objects
;
/**
...
...
@@ -42,6 +48,9 @@ public class AppSearchController {
@Value
(
"${ef.search.url}"
)
private
String
getEfSearchUrl
;
@Resource
(
name
=
"markDataServiceImpl"
)
MarkDataService
markDataService
;
@ApiOperation
(
"搜索-查热点"
)
@GetMapping
(
"/hot/list"
)
public
ResponseResult
searchHotList
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
limit
,
...
...
@@ -76,4 +85,18 @@ public class AppSearchController {
JSONObject
result
=
JSON
.
parseObject
(
responseEntity
.
getBody
());
return
ResponseResult
.
success
(
result
);
}
@ApiOperation
(
"搜索-全网搜"
)
@GetMapping
(
"/searchWhole"
)
public
ResponseResult
searchWholeNetwork
(
@RequestBody
SearchFilterDTO
dto
){
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
if
(
time
>
dto
.
getStartTime
()){
return
ResponseResult
.
failure
(
"仅能搜索近3个月内信息"
);
}
Period
periodDay
=
new
Period
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
PeriodType
.
days
());
if
(
periodDay
.
getDays
()
>
30
)
{
return
ResponseResult
.
failure
(
"时间跨度不能超过30天"
);
}
return
ResponseResult
.
success
(
markDataService
.
searchWholeNetwork
(
dto
));
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/dto/SearchFilterDTO.java
View file @
881e33a0
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.
List
;
import
java.util.
*
;
@Data
@ApiModel
(
"全网搜搜索传输类"
)
...
...
@@ -44,7 +45,7 @@ public class SearchFilterDTO {
* 关键字
*/
@ApiModelProperty
(
value
=
"关键字"
)
private
String
keyword
;
private
String
search
;
/**
* 平台
...
...
@@ -53,13 +54,15 @@ public class SearchFilterDTO {
private
List
<
String
>
platforms
;
/**
* 平台(
真正用于搜索的
)
* 平台(
查商业数据库用
)
*/
@ApiModelProperty
(
value
=
"平台(查商业数据库用)"
)
private
String
platformsStr
;
/**
* 数据类型 1:原创, 2:转发, 7:评论
* 数据类型 1:原创, 2:转发, 7:评论
(查商业数据库用)
*/
@ApiModelProperty
(
value
=
"数据类型(查商业数据库用)"
)
private
String
filterForward
=
"1,2"
;
/**
...
...
@@ -69,13 +72,27 @@ public class SearchFilterDTO {
private
String
sorter
;
/**
* 排序字段(
真正用于搜索的
)
* 排序字段(
查商业数据库用
)
*/
@ApiModelProperty
(
value
=
"排序字段(查商业数据库用)"
)
private
String
sortOf
;
/**
*
匹配域名 默认标题+内容
*
来源
*/
@ApiModelProperty
(
value
=
"来源"
)
private
String
source
;
/**
* 过滤关键字
*/
@ApiModelProperty
(
value
=
"过滤关键字"
)
private
String
filterWords
;
/**
* 匹配域名 默认标题+内容(查商业数据库用)
*/
@ApiModelProperty
(
value
=
"匹配域名(查商业数据库用)"
)
private
String
matchFields
=
null
;
/**
...
...
@@ -84,4 +101,48 @@ public class SearchFilterDTO {
@ApiModelProperty
(
value
=
"查询类型"
)
private
String
matchType
;
/**
* 重要渠道,{father:"区域",son:"北京"},{father:"全部"}
*/
@ApiModelProperty
(
value
=
"重要渠道"
)
private
Map
<
String
,
String
>
sensitiveChannels
;
/**
* 粉丝数
*/
@ApiModelProperty
(
value
=
"粉丝数"
)
private
String
fans
;
/**
* 过滤类型 标题/全文
*/
@ApiModelProperty
(
value
=
"过滤类型 标题/全文"
)
private
String
filterType
;
public
Map
<
String
,
Object
>
toMap
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"timeType"
,
"time"
);
map
.
put
(
"pt"
,
getPt
());
map
.
put
(
"matchType"
,
matchType
);
map
.
put
(
"search"
,
search
);
map
.
put
(
"startTime"
,
startTime
);
map
.
put
(
"endTime"
,
endTime
);
map
.
put
(
"source"
,
source
);
map
.
put
(
"sort"
,
Objects
.
nonNull
(
sorter
)
?
sorter
:
"DESC"
);
map
.
put
(
"page"
,
page
);
map
.
put
(
"pageSize"
,
pageSize
);
map
.
put
(
"notWords"
,
filterWords
);
map
.
put
(
"sensitiveChannels"
,
sensitiveChannels
);
map
.
put
(
"fans"
,
fans
);
map
.
put
(
"filterType"
,
filterType
);
return
map
;
}
public
List
<
String
>
getPt
()
{
return
Objects
.
nonNull
(
platforms
)
?
this
.
platforms
:
Collections
.
emptyList
();
}
public
String
getMatchType
()
{
return
Objects
.
nonNull
(
this
.
matchType
)
?
this
.
matchType
:
"标题"
;
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
881e33a0
This diff is collapsed.
Click to expand it.
src/main/resources/application-local.properties
View file @
881e33a0
...
...
@@ -75,4 +75,8 @@ ef.search.url=https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
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.captcha.url
=
https://ef.zhiweidata.com/captchaApi/getNewCaptcha.do.do?type=test
ef.checkCaptcha.url
=
https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id={1}&captcha={2}&type=test
\ No newline at end of file
ef.checkCaptcha.url
=
https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id={1}&captcha={2}&type=test
#\u5168\u7F51\u641C\u5916\u90E8\u63A5\u53E3
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
whole.search.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
\ 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