Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-golf-mobile
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c8f06452
authored
Mar 10, 2020
by
zhangchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload face
parent
64e73e46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
1 deletions
src/main/java/com/ctrip/fun/golf/service/basic/EntityImageService.java
src/main/java/com/ctrip/fun/golf/service/basic/EntityImageService.java
View file @
c8f06452
...
...
@@ -85,7 +85,7 @@ public final class EntityImageService extends BaseService {
if
(
response
.
getStatus
()
==
ResponseStatusEnum
.
SUCCESS
.
getValue
())
{
retKey
=
response
.
getBody
();
}
else
{
Map
<
String
,
String
>
tags
=
new
HashMap
<>();
Map
<
String
,
String
>
tags
=
new
HashMap
<>();
tags
.
put
(
"userId"
,
userId
);
tags
.
put
(
"bean"
,
bean
.
toString
());
logger
.
error
(
"add图片异常"
,
String
.
format
(
"status: %d, msg: %s"
,
response
.
getStatus
(),
response
.
getMessage
()),
tags
);
...
...
@@ -94,6 +94,35 @@ public final class EntityImageService extends BaseService {
return
retKey
;
}
//上传人脸照片
public
int
uploadUserFaceImage
(
String
userId
,
EntityImageBean
bean
){
String
uri
=
super
.
getServiceUri
(
"uri.EntityImage.uploadUserFaceImage"
);
int
retKey
=
0
;
Request
<
EntityImageBean
>
request
=
new
Request
<
EntityImageBean
>();
request
.
setUserId
(
userId
);
request
.
setBody
(
bean
);
HttpEntity
<
Request
<
EntityImageBean
>>
entity
=
new
HttpEntity
<
Request
<
EntityImageBean
>>(
request
);
Response
<
Integer
>
response
=
super
.
exchange
(
uri
,
HttpMethod
.
POST
,
entity
,
new
ParameterizedTypeReference
<
Response
<
Integer
>>()
{
}).
getBody
();
if
(
null
!=
response
)
{
if
(
response
.
getStatus
()
==
ResponseStatusEnum
.
SUCCESS
.
getValue
())
{
retKey
=
response
.
getBody
();
}
else
{
Map
<
String
,
String
>
tags
=
new
HashMap
<>();
tags
.
put
(
"userId"
,
userId
);
tags
.
put
(
"bean"
,
bean
.
toString
());
logger
.
error
(
"add图片异常"
,
String
.
format
(
"status: %d, msg: %s"
,
response
.
getStatus
(),
response
.
getMessage
()),
tags
);
}
}
return
retKey
;
}
/**
* 创建EntityImage
*
...
...
@@ -236,6 +265,44 @@ public final class EntityImageService extends BaseService {
}
return
entityImageBean
;
}
/*//上传人脸接口
public EntityImageBean uploadFaceImage(String entityType, int entityId, String ext, byte[] imageBytes) {
String uri = super.getServiceUri("uri.EntityImage.upload");
EntityImageBean entityImageBean = null;
Request<ImageDataBean> request = new Request<ImageDataBean>();
ImageDataBean imageDataBean = new ImageDataBean();
imageDataBean.setFileBytes(imageBytes);
request.setUserId("");
request.setBody(imageDataBean);
HttpEntity<Request<ImageDataBean>> entity = new HttpEntity<Request<ImageDataBean>>(request);
Response<EntityImageBean> response = super.exchange(uri,
HttpMethod.POST,
entity,
new ParameterizedTypeReference<Response<EntityImageBean>>() {
}).getBody();
if (null != response) {
if (response.getStatus() == ResponseStatusEnum.SUCCESS.getValue()) {
entityImageBean = response.getBody();
if(entityImageBean!=null){
entityImageBean.setEntityId(entityId);
entityImageBean.setEntityType(entityType);
entityImageBean.setCreatedTime(new Date());
entityImageBean.setSort(1000);
}
} else {
Map<String, String> tags = new HashMap<>();
tags.put("userId", "");
tags.put("bean", imageDataBean.toString());
logger.error("add图片异常", String.format("status: %d, msg: %s", response.getStatus(), response.getMessage()), tags);
}
}
return entityImageBean;
}*/
/**
* Parse image hash form complete path returned by imageWS.
...
...
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