替换strUtil.BACKSLASH为FileUtil.FILE_SEPARATOR
This commit is contained in:
parent
4639da5dc5
commit
9d2cf4c916
|
@ -82,8 +82,8 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
Map<String, PartEntity> partIdMap= partService.listByIds(partIds).stream().collect(Collectors.toMap(PartEntity::getPartId, Function.identity()));
|
||||
list.stream().forEach(req -> {
|
||||
if(partIdMap.containsKey(req.getPartId())){
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
String temp_path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
String path_prefix = permPath.concat(FileUtil.FILE_SEPARATOR).concat(req.getImageSource()).concat(FileUtil.FILE_SEPARATOR).concat(req.getPartId()).concat(FileUtil.FILE_SEPARATOR);
|
||||
String temp_path_prefix = tempPath.concat(FileUtil.FILE_SEPARATOR).concat(req.getImageSource()).concat(FileUtil.FILE_SEPARATOR).concat(req.getPartId()).concat(FileUtil.FILE_SEPARATOR);
|
||||
File file = new File(req.getImagePath());
|
||||
if(file.exists() && req.getImagePath().contains(temp_path_prefix)){
|
||||
ImageEntity entity = new ImageEntity();
|
||||
|
@ -122,7 +122,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
throw new ServiceException(Message.IMAGE_IS_EMPTY);
|
||||
}
|
||||
List<ImageReq> list = new ArrayList<>(files.length);
|
||||
String path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(imageSource).concat(StrUtil.BACKSLASH).concat(partId).concat(StrUtil.BACKSLASH);
|
||||
String path_prefix = tempPath.concat(FileUtil.FILE_SEPARATOR).concat(imageSource).concat(FileUtil.FILE_SEPARATOR).concat(partId).concat(FileUtil.FILE_SEPARATOR);
|
||||
for (MultipartFile file : files) {
|
||||
if (!file.isEmpty()) {
|
||||
try {
|
||||
|
@ -147,7 +147,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
throw new ServiceException(Message.IMAGE_SOURCE_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(imageSource).concat(StrUtil.BACKSLASH).concat(dateStr).concat(StrUtil.BACKSLASH);
|
||||
String path_prefix = permPath.concat(FileUtil.FILE_SEPARATOR).concat(dateStr).concat(FileUtil.FILE_SEPARATOR).concat(imageSource).concat(FileUtil.FILE_SEPARATOR);
|
||||
String path = path_prefix + file.getOriginalFilename();
|
||||
FileUtil.writeBytes(file.getBytes(),path);
|
||||
return path;
|
||||
|
|
Loading…
Reference in New Issue