|
@@ -928,13 +928,42 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
|
|
|
Map<String, String> param = new LinkedHashMap<>();
|
|
|
param.put("image", image);
|
|
|
param.put("image_type", "BASE64");
|
|
|
- param.put("group_id", lrjbxx.getCreateAreaCode().substring(0, 6));
|
|
|
+ param.put("group_id", lrjbxx.getLrHjdz().substring(0, 6));
|
|
|
param.put("user_id", lrjbxx.getLrJmzjhm());
|
|
|
param.put("action_type", "REPLACE");
|
|
|
JSONObject uploadRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add" +
|
|
|
"?access_token=" + getBaiduToken(), "POST", JSONObject.toJSONString(param));
|
|
|
if (ObjectUtils.isEmpty(uploadRes) || !StringUtils.equals(uploadRes.getString("error_msg"), "SUCCESS")) {
|
|
|
- throw new ServiceException("上传到百度人脸库失败");
|
|
|
+ System.out.println("百度人脸库上传失败 ============》 " + uploadRes);
|
|
|
+ } else {
|
|
|
+ System.out.println("百度人脸库上传成功 ============》 " + uploadRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void uploadBaiduBuild(InLnstLrxx lrjbxx) {
|
|
|
+ if (ObjectUtils.isEmpty(lrjbxx)) {
|
|
|
+ throw new ServiceException("老人不存在");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(lrjbxx.getLrTx())) {
|
|
|
+ throw new ServiceException("老人头像数据为空");
|
|
|
+ }
|
|
|
+// File file = new File(localFilePath + lrjbxx.getLrTx().replaceFirst("/uploadPath", ""));
|
|
|
+// if (!file.exists()) {
|
|
|
+// throw new ServiceException("老人头像不存在");
|
|
|
+// }
|
|
|
+// String image = FileUtils.file2Base64(file);
|
|
|
+ Map<String, String> param = new LinkedHashMap<>();
|
|
|
+ param.put("image", lrjbxx.getLrTx());
|
|
|
+ param.put("image_type", "BASE64");
|
|
|
+ param.put("group_id", lrjbxx.getLrHjdz().substring(0, 6));
|
|
|
+ param.put("user_id", lrjbxx.getLrJmzjhm());
|
|
|
+ param.put("action_type", "REPLACE");
|
|
|
+ JSONObject uploadRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add" +
|
|
|
+ "?access_token=" + getBaiduToken(), "POST", JSONObject.toJSONString(param));
|
|
|
+ if (ObjectUtils.isEmpty(uploadRes) || !StringUtils.equals(uploadRes.getString("error_msg"), "SUCCESS")) {
|
|
|
+ System.out.println("百度人脸库上传失败 ============》 " + uploadRes);
|
|
|
+ } else {
|
|
|
+ System.out.println("百度人脸库上传成功 ============》 " + uploadRes);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1226,6 +1255,10 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
|
|
|
ylServer.ylSync(lr.getYlcode(), lr.getYlcard(), lr.getMchnt());
|
|
|
updateZwywLrJbxxBuild(lr);
|
|
|
System.out.println("更新结束的数据 ==》 " + up);
|
|
|
+ if (!StringUtils.equals(SpringUtil.getActiveProfile(), "prod")) {
|
|
|
+ lr.setLrTx(picBase64);
|
|
|
+ uploadBaiduBuild(lr);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|