public static boolean createDirectories(Path path) {
if (!Files.exists(path)) {
try {
Files.createDirectories(path);
} catch (IOException e) {
log.error(path.toString() + " 文件夹创建失败");
e.printStackTrace();
return false;
}
}
return true;
}
StringBuilder basePath = new StringBuilder()
.append(EXCEL_FILE_LOCATION).append(id).append(File.separator)
.append(userId).append(File.separator);
Path path = Paths.get(basePath.toString());
FileUtil.createDirectories(path);
Path resolve = path.resolve(DateTimeUtil.timeStamp2String(System.currentTimeMillis(), "yyyyMMdd-HHmmss") + fs.getFileName());
Files.copy(fs.getFileStream(), resolve, StandardCopyOption.REPLACE_EXISTING);
ExcelParseConstruct.getExcelParseStrategy("1").excelModelStrategy();
String toRealPath = resolve.toRealPath(LinkOption.NOFOLLOW_LINKS).toString();