Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
245b23d6
Commit
245b23d6
authored
Oct 10, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海南人像提交(海南)
parent
0ea82b9e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
9 deletions
+24
-9
common/common_utils/src/main/java/com/founder/commonutils/util/HttpClient.java
+1
-0
common/common_utils/src/main/java/com/founder/commonutils/util/PropertieUtil.java
+2
-2
common/common_utils/src/main/java/com/founder/commonutils/util/TokenUtils.java
+1
-1
service/publicapi/src/main/java/com/founder/publicapi/controller/PeopleContoller.java
+4
-2
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/ImageServiceImpl.java
+13
-4
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/PeopleServiceImpl.java
+3
-0
No files found.
common/common_utils/src/main/java/com/founder/commonutils/util/HttpClient.java
View file @
245b23d6
...
@@ -66,6 +66,7 @@ public class HttpClient {
...
@@ -66,6 +66,7 @@ public class HttpClient {
if
(
result
.
getStatusLine
().
getStatusCode
()
==
HttpStatus
.
SC_OK
){
if
(
result
.
getStatusLine
().
getStatusCode
()
==
HttpStatus
.
SC_OK
){
// 读取服务器返回的json数据(然后解析)
// 读取服务器返回的json数据(然后解析)
jsonResult
=
EntityUtils
.
toString
(
result
.
getEntity
(),
"utf-8"
);
jsonResult
=
EntityUtils
.
toString
(
result
.
getEntity
(),
"utf-8"
);
System
.
out
.
println
(
"back="
+
jsonResult
);
}
else
{
}
else
{
throw
new
Exception
();
throw
new
Exception
();
}
}
...
...
common/common_utils/src/main/java/com/founder/commonutils/util/PropertieUtil.java
View file @
245b23d6
...
@@ -16,7 +16,7 @@ public class PropertieUtil {
...
@@ -16,7 +16,7 @@ public class PropertieUtil {
String
value
=
""
;
String
value
=
""
;
try
{
try
{
Properties
prop
=
new
Properties
();
Properties
prop
=
new
Properties
();
InputStream
fileInputStream
=
PropertieUtil
.
class
.
getResourceAs
Stream
(
url
);
FileInputStream
fileInputStream
=
new
FileInput
Stream
(
url
);
prop
.
load
(
fileInputStream
);
prop
.
load
(
fileInputStream
);
value
=
prop
.
getProperty
(
key
);
value
=
prop
.
getProperty
(
key
);
fileInputStream
.
close
();
fileInputStream
.
close
();
...
@@ -34,7 +34,7 @@ public class PropertieUtil {
...
@@ -34,7 +34,7 @@ public class PropertieUtil {
String
filePath
=
token_url
;
String
filePath
=
token_url
;
// 获取配置文件
// 获取配置文件
Properties
pps
=
new
Properties
();
Properties
pps
=
new
Properties
();
InputStream
fileInputStream
=
PropertieUtil
.
class
.
getResourceAs
Stream
(
filePath
);
FileInputStream
fileInputStream
=
new
FileInput
Stream
(
filePath
);
InputStream
in
=
new
BufferedInputStream
(
fileInputStream
);
InputStream
in
=
new
BufferedInputStream
(
fileInputStream
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
in
,
"UTF-8"
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
in
,
"UTF-8"
);
pps
.
load
(
inputStreamReader
);
pps
.
load
(
inputStreamReader
);
...
...
common/common_utils/src/main/java/com/founder/commonutils/util/TokenUtils.java
View file @
245b23d6
...
@@ -32,7 +32,7 @@ import java.util.*;
...
@@ -32,7 +32,7 @@ import java.util.*;
public
class
TokenUtils
{
public
class
TokenUtils
{
private
static
Log
logger
=
LogFactory
.
getLog
(
HttpClient
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
HttpClient
.
class
);
private
static
RequestConfig
requestConfig
=
null
;
private
static
RequestConfig
requestConfig
=
null
;
private
static
String
tokenPath
=
"/token.properties"
;
private
static
String
tokenPath
=
"/
data/software/jar/
token.properties"
;
static
{
static
{
// 设置请求和传输超时时间
// 设置请求和传输超时时间
...
...
service/publicapi/src/main/java/com/founder/publicapi/controller/PeopleContoller.java
View file @
245b23d6
...
@@ -6,6 +6,7 @@ import com.founder.commonutils.peopleEntity.NaoTuRybq;
...
@@ -6,6 +6,7 @@ import com.founder.commonutils.peopleEntity.NaoTuRybq;
import
com.founder.commonutils.peopleEntity.PeopleResourceTrackResult
;
import
com.founder.commonutils.peopleEntity.PeopleResourceTrackResult
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.util.JsonUtils
;
import
com.founder.commonutils.util.JsonUtils
;
import
com.founder.publicapi.service.ImageService
;
import
com.founder.publicapi.service.PeopleService
;
import
com.founder.publicapi.service.PeopleService
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperationType
;
import
com.founder.servicebase.logs.OperationType
;
...
@@ -36,7 +37,8 @@ public class PeopleContoller {
...
@@ -36,7 +37,8 @@ public class PeopleContoller {
@Autowired
@Autowired
private
PeopleService
peopleService
;
private
PeopleService
peopleService
;
@Autowired
private
ImageService
imageService
;
@ApiOperation
(
value
=
"虚实身份信息"
)
@ApiOperation
(
value
=
"虚实身份信息"
)
@OperLog
(
message
=
"虚实身份信息"
,
operation
=
OperationType
.
QUERY
)
@OperLog
(
message
=
"虚实身份信息"
,
operation
=
OperationType
.
QUERY
)
...
@@ -180,7 +182,7 @@ public class PeopleContoller {
...
@@ -180,7 +182,7 @@ public class PeopleContoller {
@ApiOperation
(
value
=
"发起人像比对任务"
,
notes
=
"发起人像比对任务"
)
@ApiOperation
(
value
=
"发起人像比对任务"
,
notes
=
"发起人像比对任务"
)
public
MapRestResult
getRxbd
(
public
MapRestResult
getRxbd
(
@RequestParam
(
value
=
"file"
,
required
=
false
)
MultipartFile
file
,
@RequestParam
(
value
=
"base64Img"
,
required
=
false
)
String
base64Img
,
@RequestParam
(
value
=
"fjmc"
,
required
=
false
)
String
fjmc
,
@RequestParam
(
value
=
"threshold"
,
required
=
false
)
String
threshold
,
@RequestParam
(
value
=
"topNumber"
,
required
=
false
)
String
topNumber
,
@RequestParam
(
value
=
"model"
,
required
=
false
)
String
model
,
HttpServletRequest
request
)
{
@RequestParam
(
value
=
"file"
,
required
=
false
)
MultipartFile
file
,
@RequestParam
(
value
=
"base64Img"
,
required
=
false
)
String
base64Img
,
@RequestParam
(
value
=
"fjmc"
,
required
=
false
)
String
fjmc
,
@RequestParam
(
value
=
"threshold"
,
required
=
false
)
String
threshold
,
@RequestParam
(
value
=
"topNumber"
,
required
=
false
)
String
topNumber
,
@RequestParam
(
value
=
"model"
,
required
=
false
)
String
model
,
HttpServletRequest
request
)
{
return
peopl
eService
.
getFqRxbdjgrw
(
file
,
base64Img
,
request
,
fjmc
,
threshold
,
topNumber
,
model
);
return
imag
eService
.
getFqRxbdjgrw
(
file
,
base64Img
,
request
,
fjmc
,
threshold
,
topNumber
,
model
);
}
}
}
}
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/ImageServiceImpl.java
View file @
245b23d6
...
@@ -24,6 +24,8 @@ import java.util.Map;
...
@@ -24,6 +24,8 @@ import java.util.Map;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/*
/*
*
*
...
@@ -61,8 +63,9 @@ public class ImageServiceImpl implements ImageService {
...
@@ -61,8 +63,9 @@ public class ImageServiceImpl implements ImageService {
return
resultMapAll
;
return
resultMapAll
;
}
}
}
}
BASE64Encoder
base64Encoder
=
new
BASE64Encoder
();
// base64处理
String
base64Img
=
new
BASE64Encoder
().
encode
(
file
.
getBytes
()).
replaceAll
(
"[\\s*\t\n\r]"
,
""
);
faceSearchParam
.
setBase64Img
(
base64Encoder
.
encode
(
file
.
getBytes
()));
System
.
out
.
println
(
base64Img
);
faceSearchParam
.
setBase64Img
(
base64Img
);
JSONObject
params
=
new
JSONObject
();
// 请求参数
JSONObject
params
=
new
JSONObject
();
// 请求参数
List
<
FaceSearchResult
>
cameraFaceResults
=
new
ArrayList
<>();
// 存储返回结果
List
<
FaceSearchResult
>
cameraFaceResults
=
new
ArrayList
<>();
// 存储返回结果
//请求参数
//请求参数
...
@@ -224,10 +227,16 @@ public class ImageServiceImpl implements ImageService {
...
@@ -224,10 +227,16 @@ public class ImageServiceImpl implements ImageService {
JSONObject
params
=
new
JSONObject
();
// 请求参数
JSONObject
params
=
new
JSONObject
();
// 请求参数
MapRestResult
mapRestResult
=
null
;
MapRestResult
mapRestResult
=
null
;
try
{
try
{
Matcher
matcher
=
Pattern
.
compile
(
"^data.(.*?);base64,"
).
matcher
(
base64Img
);
if
(
matcher
.
find
()){
base64Img
=
base64Img
.
replace
(
matcher
.
group
(),
""
);
base64Img
=
base64Img
.
replaceAll
(
"[\\s*\t\n\r]"
,
""
);
System
.
out
.
println
(
base64Img
);
}
//请求参数
//请求参数
params
.
put
(
"compareFace"
,
new
BASE64Encoder
().
encode
(
file
.
getBytes
())
);
// 人像base64
params
.
put
(
"compareFace"
,
base64Img
);
// 人像base64
params
.
put
(
"faceType"
,
2
);
// 1:url 全 路 径 2:base64
params
.
put
(
"faceType"
,
2
);
// 1:url 全 路 径 2:base64
params
.
put
(
"thresholdMin"
,
0.
8
5
);
// 最低相似度,不能 低 于0.85, 默认0.85
params
.
put
(
"thresholdMin"
,
0.
9
5
);
// 最低相似度,不能 低 于0.85, 默认0.85
String
url
=
imageUrl
+
"/govServerWeb/personFace/compareFace"
;
String
url
=
imageUrl
+
"/govServerWeb/personFace/compareFace"
;
String
resultString
=
HttpClient
.
doPostJson
(
url
,
getToken
(),
String
.
valueOf
(
params
));
String
resultString
=
HttpClient
.
doPostJson
(
url
,
getToken
(),
String
.
valueOf
(
params
));
if
(
null
!=
resultString
)
{
//如果返回结果不为空
if
(
null
!=
resultString
)
{
//如果返回结果不为空
...
...
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/PeopleServiceImpl.java
View file @
245b23d6
...
@@ -820,6 +820,9 @@ public class PeopleServiceImpl implements PeopleService {
...
@@ -820,6 +820,9 @@ public class PeopleServiceImpl implements PeopleService {
reqEntity
.
addPart
(
"threshold"
,
new
StringBody
(
threshold
));
reqEntity
.
addPart
(
"threshold"
,
new
StringBody
(
threshold
));
reqEntity
.
addPart
(
"topNumber"
,
new
StringBody
(
topNumber
));
reqEntity
.
addPart
(
"topNumber"
,
new
StringBody
(
topNumber
));
reqEntity
.
addPart
(
"userId"
,
new
StringBody
(
"150147"
));
reqEntity
.
addPart
(
"userId"
,
new
StringBody
(
"150147"
));
reqEntity
.
addPart
(
"userIdNumber"
,
new
StringBody
(
"150147"
));
reqEntity
.
addPart
(
"userName"
,
new
StringBody
(
"150147"
));
reqEntity
.
addPart
(
"userName"
,
new
StringBody
(
"150147"
));
httppost
.
setEntity
(
reqEntity
);
httppost
.
setEntity
(
reqEntity
);
HttpResponse
response
=
httpclient
.
execute
(
httppost
);
HttpResponse
response
=
httpclient
.
execute
(
httppost
);
...
...
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