| | |
| | | |
| | | MetaEntity old = metaService.selectByGuid(mf.getGuid()); |
| | | if (null != old) { |
| | | mf.setMsg("文件已存在"); |
| | | mf.setPath(old.getPath()); |
| | | file.delete(); |
| | | return 0; |
| | | } |
| | | |
| | | String uploadPath = pathHelper.getUploadFullPath(); |
| | | String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); |
| | | String subPath = FileHelper.getRelativePath(targetPath); |
| | | |
| | | File newFile = new File(targetPath); |
| | | if (newFile.exists()) { |
| | | mf.setMsg("文件已存在"); |
| | | mf.setPath(subPath); |
| | | file.delete(); |
| | | return 0; |
| | | } |
| | | |
| | | file.renameTo(newFile); |
| | | |
| | | String subPath = FileHelper.getRelativePath(targetPath); |
| | | mf.setPath(subPath); |
| | | |
| | | return 1; |
| | |
| | | |
| | | MetaEntity old = metaService.selectByGuid(mf.getGuid()); |
| | | if (null != old) { |
| | | mf.setMsg("文件已存在"); |
| | | mf.setPath(old.getPath()); |
| | | FileHelper.deleteFiles(file); |
| | | return; |
| | | } |
| | | |
| | | String uploadPath = pathHelper.getUploadFullPath(); |
| | | String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); |
| | | String subPath = FileHelper.getRelativePath(targetPath); |
| | | |
| | | File newFile = new File(targetPath); |
| | | if (newFile.exists() && newFile.isDirectory()) { |
| | | mf.setMsg("文件已存在"); |
| | | mf.setPath(subPath); |
| | | FileHelper.deleteFiles(file); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | for (File f : files) { |
| | | String subPath = targetPath + File.separator + FileHelper.getFileName(f.getPath()); |
| | | f.renameTo(new File(subPath)); |
| | | String subFile = targetPath + File.separator + FileHelper.getFileName(f.getPath()); |
| | | f.renameTo(new File(subFile)); |
| | | } |
| | | |
| | | String subPath = FileHelper.getRelativePath(targetPath); |
| | | mf.setPath(subPath); |
| | | } |
| | | |