diff --git a/core/src/main/java/com/dite/znpt/service/impl/ImageServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ImageServiceImpl.java index 782d5de..9b8e0f2 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ImageServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ImageServiceImpl.java @@ -82,8 +82,8 @@ public class ImageServiceImpl extends ServiceImpl impl Map 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 impl throw new ServiceException(Message.IMAGE_IS_EMPTY); } List 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 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;