Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c8e15d2d
Commit
c8e15d2d
authored
Nov 18, 2020
by
wanghuiyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pc和M站调整
parent
adee989a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
alioss-java/src/main/java/com/example/aliossjava/common/CompanyNameUtils.java
+25
-2
No files found.
alioss-java/src/main/java/com/example/aliossjava/common/CompanyNameUtils.java
View file @
c8e15d2d
...
@@ -28,6 +28,18 @@ import java.util.*;
...
@@ -28,6 +28,18 @@ import java.util.*;
@Service
@Service
public
class
CompanyNameUtils
{
public
class
CompanyNameUtils
{
/**
*
* @param region 地区
* @param type 类型
* @param modality 组织形式
* @param nameNum 名字数量
* @param goodName 包含关键字
* @param from 从第几个开始
* @param size 一页有多少个
* @return
* @throws Exception
*/
public
Map
<
String
,
Object
>
nameList
(
String
region
,
String
type
,
String
modality
,
String
nameNum
,
String
goodName
,
Integer
from
,
Integer
size
)
throws
Exception
{
public
Map
<
String
,
Object
>
nameList
(
String
region
,
String
type
,
String
modality
,
String
nameNum
,
String
goodName
,
Integer
from
,
Integer
size
)
throws
Exception
{
Map
<
String
,
Object
>
stringObjectMap
=
querycompanyNanme
(
goodName
,
nameNum
,
from
,
size
);
Map
<
String
,
Object
>
stringObjectMap
=
querycompanyNanme
(
goodName
,
nameNum
,
from
,
size
);
List
<
String
>
querycompanyNanme
=
(
List
<
String
>)
stringObjectMap
.
get
(
"companyName"
);
List
<
String
>
querycompanyNanme
=
(
List
<
String
>)
stringObjectMap
.
get
(
"companyName"
);
...
@@ -47,6 +59,9 @@ public class CompanyNameUtils {
...
@@ -47,6 +59,9 @@ public class CompanyNameUtils {
* @return
* @return
*/
*/
public
static
Map
<
String
,
Object
>
querycompanyNanme
(
String
fieldKey
,
String
fieldnum
,
Integer
from
,
Integer
size
)
throws
Exception
{
public
static
Map
<
String
,
Object
>
querycompanyNanme
(
String
fieldKey
,
String
fieldnum
,
Integer
from
,
Integer
size
)
throws
Exception
{
if
(
fieldnum
==
null
||
""
.
equals
(
fieldnum
)){
fieldnum
=
"不限"
;
}
CredentialsProvider
credentialsProvider
=
new
BasicCredentialsProvider
();
CredentialsProvider
credentialsProvider
=
new
BasicCredentialsProvider
();
credentialsProvider
.
setCredentials
(
AuthScope
.
ANY
,
credentialsProvider
.
setCredentials
(
AuthScope
.
ANY
,
new
UsernamePasswordCredentials
(
"elastic"
,
"w3OL+51eo*)c=^7"
));
new
UsernamePasswordCredentials
(
"elastic"
,
"w3OL+51eo*)c=^7"
));
...
@@ -74,8 +89,16 @@ public class CompanyNameUtils {
...
@@ -74,8 +89,16 @@ public class CompanyNameUtils {
must
(
QueryBuilders
.
termsQuery
(
"company_name"
,
fieldKey
))
must
(
QueryBuilders
.
termsQuery
(
"company_name"
,
fieldKey
))
.
must
(
QueryBuilders
.
termQuery
(
"name_size"
,
Integer
.
valueOf
(
fieldnum
))));
.
must
(
QueryBuilders
.
termQuery
(
"name_size"
,
Integer
.
valueOf
(
fieldnum
))));
}
}
searchSourceBuilder
.
from
(
from
);
if
(
from
==
null
){
searchSourceBuilder
.
size
(
size
);
searchSourceBuilder
.
from
(
0
);
}
else
{
searchSourceBuilder
.
from
(
from
);
}
if
(
size
==
null
){
searchSourceBuilder
.
size
(
20
);
}
else
{
searchSourceBuilder
.
size
(
size
);
}
searchRequest
.
source
(
searchSourceBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
SearchResponse
searchResponse
=
restClient
.
search
(
searchRequest
,
RequestOptions
.
DEFAULT
);
SearchResponse
searchResponse
=
restClient
.
search
(
searchRequest
,
RequestOptions
.
DEFAULT
);
List
<
String
>
result
=
new
LinkedList
<>();
List
<
String
>
result
=
new
LinkedList
<>();
...
...
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