Commit c8f06452 by zhangchen

upload face

parent 64e73e46
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment