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
e5229021
Commit
e5229021
authored
Oct 28, 2020
by
wanghuiyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
王辉云 添加count
parent
06d7e2c3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
9 deletions
+18
-9
alioss-java/.gitignore
+2
-0
alioss-java/src/main/java/com/example/aliossjava/companyName.java
+14
-8
alioss-java/src/main/java/com/example/aliossjava/uploadossapi.java
+2
-1
alioss-java/target/classes/com/example/aliossjava/companyName$1.class
+0
-0
alioss-java/target/classes/com/example/aliossjava/companyName.class
+0
-0
alioss-java/target/classes/com/example/aliossjava/uploadossapi.class
+0
-0
No files found.
alioss-java/.gitignore
View file @
e5229021
...
@@ -13,6 +13,8 @@ HELP.md
...
@@ -13,6 +13,8 @@ HELP.md
.sts4-cache
.sts4-cache
### IntelliJ IDEA ###
### IntelliJ IDEA ###
/target
*/target/
.idea
.idea
*.iws
*.iws
*.iml
*.iml
...
...
alioss-java/src/main/java/com/example/aliossjava/companyName.java
View file @
e5229021
...
@@ -28,14 +28,17 @@ import java.util.*;
...
@@ -28,14 +28,17 @@ import java.util.*;
@Service
@Service
public
class
companyName
{
public
class
companyName
{
public
List
<
String
>
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
{
List
<
String
>
querycompanyNanme
=
querycompanyNanme
(
goodName
,
nameNum
,
from
,
size
);
Map
<
String
,
Object
>
stringObjectMap
=
querycompanyNanme
(
goodName
,
nameNum
,
from
,
size
);
List
<
String
>
querycompanyNanme
=
(
List
<
String
>)
stringObjectMap
.
get
(
"companyName"
);
List
<
String
>
nameList
=
new
ArrayList
<>();
List
<
String
>
nameList
=
new
ArrayList
<>();
for
(
String
str
:
querycompanyNanme
)
{
for
(
String
str
:
querycompanyNanme
){
JSONObject
responseObj
=
JSONObject
.
parseObject
(
str
);
JSONObject
responseObj
=
JSONObject
.
parseObject
(
str
);
nameList
.
add
(
region
+
responseObj
.
getString
(
"company_name"
)
+
type
+
modality
);
nameList
.
add
(
region
+
responseObj
.
getString
(
"company_name"
)
+
type
+
modality
);
}
}
return
nameList
;
stringObjectMap
.
remove
(
"companyName"
);
stringObjectMap
.
put
(
"companyName"
,
nameList
);
return
stringObjectMap
;
}
}
/**
/**
...
@@ -43,7 +46,7 @@ public class companyName {
...
@@ -43,7 +46,7 @@ public class companyName {
*
*
* @return
* @return
*/
*/
public
static
List
<
String
>
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
{
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"
));
...
@@ -76,11 +79,14 @@ public class companyName {
...
@@ -76,11 +79,14 @@ public class companyName {
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
<>();
SearchHits
searchHits
=
searchResponse
.
getHits
();
SearchHits
searchHits
=
searchResponse
.
getHits
();
searchHits
.
forEach
(
i
->
{
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
searchHits
.
forEach
(
i
->{
result
.
add
(
i
.
getSourceAsString
());
result
.
add
(
i
.
getSourceAsString
());
});
});
return
result
;
hashMap
.
put
(
"companyName"
,
result
);
hashMap
.
put
(
"count"
,
searchHits
.
getTotalHits
().
value
);
return
hashMap
;
}
}
}
}
alioss-java/src/main/java/com/example/aliossjava/uploadossapi.java
View file @
e5229021
...
@@ -9,6 +9,7 @@ import javax.validation.Valid;
...
@@ -9,6 +9,7 @@ import javax.validation.Valid;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RestController
...
@@ -51,7 +52,7 @@ public class uploadossapi {
...
@@ -51,7 +52,7 @@ public class uploadossapi {
*/
*/
@ResponseBody
@ResponseBody
@RequestMapping
(
value
=
"/getNames"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/getNames"
,
method
=
RequestMethod
.
POST
)
public
List
<
String
>
companyName
(
@RequestBody
@Valid
String
baseinfo
)
throws
Exception
{
public
Map
<
String
,
Object
>
companyName
(
@RequestBody
@Valid
String
baseinfo
)
throws
Exception
{
try
{
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
baseinfo
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
baseinfo
);
...
...
alioss-java/target/classes/com/example/aliossjava/companyName$1.class
View file @
e5229021
No preview for this file type
alioss-java/target/classes/com/example/aliossjava/companyName.class
View file @
e5229021
No preview for this file type
alioss-java/target/classes/com/example/aliossjava/uploadossapi.class
View file @
e5229021
No preview for this file type
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