Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-app-report
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
Administrator
xzxt-app-report
Commits
78661966
Commit
78661966
authored
May 07, 2022
by
wang_jiaxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改全国ES接口工具类,增加范型限制
parent
4c76ae89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/main/java/org/springblade/founder/utils/Entity/QgEsEnum.java
+3
-3
src/main/java/org/springblade/founder/utils/QgEsUtil.java
+4
-3
No files found.
src/main/java/org/springblade/founder/utils/Entity/QgEsEnum.java
View file @
78661966
...
@@ -15,9 +15,9 @@ public enum QgEsEnum {
...
@@ -15,9 +15,9 @@ public enum QgEsEnum {
//全国ES接口url
//全国ES接口url
private
final
String
url
;
private
final
String
url
;
//返回类型(实体类class对象)
//返回类型(实体类class对象)
private
final
Class
<?>
type
;
private
final
Class
<?
extends
QgEsEntity
>
type
;
QgEsEnum
(
String
url
,
Class
<?>
type
)
{
QgEsEnum
(
String
url
,
Class
<?
extends
QgEsEntity
>
type
)
{
this
.
url
=
url
;
this
.
url
=
url
;
this
.
type
=
type
;
this
.
type
=
type
;
}
}
...
@@ -26,7 +26,7 @@ public enum QgEsEnum {
...
@@ -26,7 +26,7 @@ public enum QgEsEnum {
return
url
;
return
url
;
}
}
public
Class
<?>
getType
()
{
public
Class
<?
extends
QgEsEntity
>
getType
()
{
return
type
;
return
type
;
}
}
}
}
src/main/java/org/springblade/founder/utils/QgEsUtil.java
View file @
78661966
...
@@ -91,9 +91,10 @@ public class QgEsUtil {
...
@@ -91,9 +91,10 @@ public class QgEsUtil {
String
resultJson
=
HttpUtils
.
doPostJson
(
url
+
qgEsEnum
.
getUrl
(),
headers
,
json
.
toString
());
String
resultJson
=
HttpUtils
.
doPostJson
(
url
+
qgEsEnum
.
getUrl
(),
headers
,
json
.
toString
());
HashMap
<
String
,
Object
>
map
=
getResultMapByJsonAndType
(
qgEsEnum
.
getType
(),
resultJson
);
HashMap
<
String
,
Object
>
map
=
getResultMapByJsonAndType
(
qgEsEnum
.
getType
(),
resultJson
);
List
<
T
>
javaList
=
(
List
<
T
>)
map
.
get
(
"rows"
);
List
<
T
>
javaList
=
(
List
<
T
>)
map
.
get
(
"rows"
);
if
(
javaList
==
null
||
javaList
.
isEmpty
()
)
{
if
(
javaList
==
null
)
{
return
javaList
==
null
?
new
ArrayList
<>(
0
)
:
javaList
;
return
new
ArrayList
<>(
0
)
;
}
}
return
javaList
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"查询全国ES接口报错"
,
e
);
log
.
error
(
"查询全国ES接口报错"
,
e
);
}
}
...
@@ -211,7 +212,7 @@ public class QgEsUtil {
...
@@ -211,7 +212,7 @@ public class QgEsUtil {
* @author lystar
* @author lystar
* 2022/5/6 16:29
* 2022/5/6 16:29
*/
*/
private
static
HashMap
<
String
,
Object
>
getResultMapByJsonAndType
(
Class
<?>
type
,
String
json
)
throws
Exception
{
private
static
HashMap
<
String
,
Object
>
getResultMapByJsonAndType
(
Class
<?
extends
QgEsEntity
>
type
,
String
json
)
throws
Exception
{
if
(
type
==
null
)
{
if
(
type
==
null
)
{
throw
new
Exception
(
"查询案件是否存在请直接使用asjApiIsExist方法"
);
throw
new
Exception
(
"查询案件是否存在请直接使用asjApiIsExist方法"
);
}
}
...
...
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