人脸照片上传未检测到人脸修改
This commit is contained in:
parent
55e0d7f46a
commit
b4cb89d1a8
|
|
@ -299,6 +299,9 @@ public class BraceletServiceImpl implements BraceletService{
|
||||||
R<Boolean> r= sourceService.addFileSource(fileVo, SecurityConstants.INNER);
|
R<Boolean> r= sourceService.addFileSource(fileVo, SecurityConstants.INNER);
|
||||||
if(r.getData()){
|
if(r.getData()){
|
||||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "ls-" + user.getId());
|
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "ls-" + user.getId());
|
||||||
|
if(ajaxResult.get("data") == null){
|
||||||
|
throw new ServiceException("人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||||
Integer code = data.getInteger("code");
|
Integer code = data.getInteger("code");
|
||||||
String msg = data.getString("msg");
|
String msg = data.getString("msg");
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.bonus.common.core.constant.BusinessConstants;
|
||||||
import com.bonus.common.core.constant.HttpStatus;
|
import com.bonus.common.core.constant.HttpStatus;
|
||||||
import com.bonus.common.core.constant.SecurityConstants;
|
import com.bonus.common.core.constant.SecurityConstants;
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.*;
|
import com.bonus.common.core.utils.*;
|
||||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||||
import com.bonus.common.core.utils.global.SystemGlobal;
|
import com.bonus.common.core.utils.global.SystemGlobal;
|
||||||
|
|
@ -184,6 +185,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
delFileId = uploadFile(file, vo);
|
delFileId = uploadFile(file, vo);
|
||||||
// 添加人脸照片至人脸库
|
// 添加人脸照片至人脸库
|
||||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||||
|
if(ajaxResult.get("data") == null){
|
||||||
|
throw new ServiceException("人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||||
Integer code = data.getInteger("code");
|
Integer code = data.getInteger("code");
|
||||||
String msg = data.getString("msg");
|
String msg = data.getString("msg");
|
||||||
|
|
@ -199,6 +203,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
if (delFileId != null) {
|
if (delFileId != null) {
|
||||||
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
||||||
}
|
}
|
||||||
|
if(Objects.equals(e.getMessage(),"人脸照片未检测到人脸")){
|
||||||
|
return AjaxResult.error("人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
@ -266,6 +273,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||||
|
if(ajaxResult.get("data") == null){
|
||||||
|
throw new ServiceException("人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||||
Integer code = data.getInteger("code");
|
Integer code = data.getInteger("code");
|
||||||
String msg = data.getString("msg");
|
String msg = data.getString("msg");
|
||||||
|
|
@ -282,6 +292,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
if (StringUtils.isNotEmpty(delFileId)) {
|
if (StringUtils.isNotEmpty(delFileId)) {
|
||||||
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
||||||
}
|
}
|
||||||
|
if(Objects.equals(e.getMessage(),"人脸照片未检测到人脸")){
|
||||||
|
return AjaxResult.error("人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
@ -500,6 +513,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
mapper.addPerson(vo);
|
mapper.addPerson(vo);
|
||||||
// 推送人脸照片到人脸库,并更新推送状态
|
// 推送人脸照片到人脸库,并更新推送状态
|
||||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(vo.getFile()), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(vo.getFile()), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||||
|
if(ajaxResult.get("data") == null){
|
||||||
|
throw new ServiceException("第" + vo.getSerialNumber() +"人脸照片未检测到人脸");
|
||||||
|
}
|
||||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||||
Integer code = data.getInteger("code");
|
Integer code = data.getInteger("code");
|
||||||
String msg = data.getString("msg");
|
String msg = data.getString("msg");
|
||||||
|
|
@ -527,6 +543,9 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
||||||
delFaceToLibrary(null, FaceCodeUtil.DEL, errorIdLists.get(i));
|
delFaceToLibrary(null, FaceCodeUtil.DEL, errorIdLists.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(e.getMessage().contains("人脸照片未检测到人脸")){
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue