|
@@ -591,7 +591,7 @@ public class PersonService {
|
|
String image = idenPerson.getImage();
|
|
String image = idenPerson.getImage();
|
|
IdenCommunity idenCommunity = this.idenCommunityService.getById(idenPerson.getCommunityId());
|
|
IdenCommunity idenCommunity = this.idenCommunityService.getById(idenPerson.getCommunityId());
|
|
if (StringUtils.isNotEmpty(image) && idenCommunity != null) {
|
|
if (StringUtils.isNotEmpty(image) && idenCommunity != null) {
|
|
- File imageFile = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + image.substring(image.lastIndexOf("/")));
|
|
|
|
|
|
+ File imageFile = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + image.substring(image.lastIndexOf("/") + 1));
|
|
if(imageFile.exists()){
|
|
if(imageFile.exists()){
|
|
imageFile.delete();
|
|
imageFile.delete();
|
|
}
|
|
}
|
|
@@ -675,7 +675,7 @@ public class PersonService {
|
|
throw new BDException("图像文件必须是图片格式!");
|
|
throw new BDException("图像文件必须是图片格式!");
|
|
}
|
|
}
|
|
|
|
|
|
- String saveFileName = DateUtils.getCurrYyyyMMddHHmmssDate() + "_" + UUID.randomUUID().toString() + fileName.substring(fileName.lastIndexOf("."), fileName.length());
|
|
|
|
|
|
+ String saveFileName = DateUtils.getCurrYyyyMMddHHmmssDate() + "_" + UUID.randomUUID().toString() + fileName.substring(fileName.lastIndexOf("."));
|
|
String uploadDir = idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/";
|
|
String uploadDir = idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/";
|
|
File uploadDirFile = new File(uploadDir);
|
|
File uploadDirFile = new File(uploadDir);
|
|
if (!uploadDirFile.exists()){
|
|
if (!uploadDirFile.exists()){
|
|
@@ -787,7 +787,7 @@ public class PersonService {
|
|
String newImage = vo.getImage();
|
|
String newImage = vo.getImage();
|
|
if (StringUtils.isNotEmpty(newImage) && !newImage.equals(oldImage)){
|
|
if (StringUtils.isNotEmpty(newImage) && !newImage.equals(oldImage)){
|
|
//识别
|
|
//识别
|
|
- String fileNameNew = newImage.substring(newImage.lastIndexOf("/"));
|
|
|
|
|
|
+ String fileNameNew = newImage.substring(newImage.lastIndexOf("/") + 1);
|
|
File imgFileNew = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + fileNameNew);
|
|
File imgFileNew = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + fileNameNew);
|
|
String featPtr = FaceIdenTool.getFeatPtr(idenRoot,imgFileNew);
|
|
String featPtr = FaceIdenTool.getFeatPtr(idenRoot,imgFileNew);
|
|
if (FaceIdenTool.isBad(featPtr)){
|
|
if (FaceIdenTool.isBad(featPtr)){
|
|
@@ -803,7 +803,7 @@ public class PersonService {
|
|
idenPerson.setFeatPtr(featPtr);
|
|
idenPerson.setFeatPtr(featPtr);
|
|
// 删除老的文件
|
|
// 删除老的文件
|
|
if(StringUtils.isNotEmpty(oldImage)){
|
|
if(StringUtils.isNotEmpty(oldImage)){
|
|
- String fileNameOld = oldImage.substring(oldImage.lastIndexOf("/"));
|
|
|
|
|
|
+ String fileNameOld = oldImage.substring(oldImage.lastIndexOf("/") + 1);
|
|
File imgFileOld = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + fileNameOld);
|
|
File imgFileOld = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + fileNameOld);
|
|
if(imgFileOld.exists()){
|
|
if(imgFileOld.exists()){
|
|
imgFileOld.delete();
|
|
imgFileOld.delete();
|
|
@@ -841,7 +841,7 @@ public class PersonService {
|
|
|
|
|
|
private String idenFeatPtr(String image,String communityCode) {
|
|
private String idenFeatPtr(String image,String communityCode) {
|
|
|
|
|
|
- String fileName = image.substring(image.lastIndexOf("/"));
|
|
|
|
|
|
+ String fileName = image.substring(image.lastIndexOf("/") + 1);
|
|
File imgFile = new File(idenRoot + "data/final/person/image/"+ communityCode + "/" + fileName);
|
|
File imgFile = new File(idenRoot + "data/final/person/image/"+ communityCode + "/" + fileName);
|
|
String featPtr = FaceIdenTool.getFeatPtr(idenRoot,imgFile);
|
|
String featPtr = FaceIdenTool.getFeatPtr(idenRoot,imgFile);
|
|
if (FaceIdenTool.isBad(featPtr)) {
|
|
if (FaceIdenTool.isBad(featPtr)) {
|