|
@@ -235,7 +235,7 @@ public class HouseController extends BaseController {
|
|
|
continue;
|
|
|
}
|
|
|
// 获取图片房间类型
|
|
|
- String imageType = StringUtils.substringBefore(filename, "_");
|
|
|
+ String imageType = StringUtils.substringBefore(newFileName, "_");
|
|
|
imageEntity.setType(imageType);
|
|
|
if(StringUtils.isNotBlank(imageEntity.getLocalPath())){
|
|
|
String localPath = imageEntity.getLocalPath();
|
|
@@ -244,8 +244,9 @@ public class HouseController extends BaseController {
|
|
|
log.warn("照片本地路径格式有误");
|
|
|
continue;
|
|
|
}
|
|
|
- String localDirectory = localPath.substring(index , localPath.length());
|
|
|
+ String localDirectory = localPath.substring(0 , index);
|
|
|
String newFileFullPath = localDirectory + newFileName;
|
|
|
+ log.info("将进行文件名称修改,将[{}]修改成:[{}]" , localPath , newFileFullPath);
|
|
|
File oldImage = new File(localPath);
|
|
|
File newImage = new File(newFileFullPath);
|
|
|
try {
|
|
@@ -254,6 +255,10 @@ public class HouseController extends BaseController {
|
|
|
log.error("复制本地照片出现异常");
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ boolean delLocal = FileUtils.deleteFile(localPath);
|
|
|
+ if(!delLocal){
|
|
|
+ log.error("删除改名之前的照片[{}]失败" , localPath);
|
|
|
+ }
|
|
|
imageEntity.setLocalPath(newFileFullPath);
|
|
|
imageEntity.setPath(newFileFullPath);
|
|
|
}
|
|
@@ -416,7 +421,7 @@ public class HouseController extends BaseController {
|
|
|
saveFileToLocal(file , fileFullPath);
|
|
|
boolean delResult = FileUtils.deleteFile(oldFileFullPath);
|
|
|
if(!delResult){
|
|
|
- log.error("删除旧文件[{}]失败" , delResult);
|
|
|
+ log.error("删除旧文件[{}]失败" , oldFileFullPath);
|
|
|
}
|
|
|
File localFile = new File(fileFullPath);
|
|
|
//生成缩略图,并上传到oss
|