String entrust_file_path;//base64加密的
byte[] buffer; String filename = ""; try { buffer = Base64Utils.decodeFromString(entrust_file_path); String uuid = UUID.randomUUID().toString().replaceAll("-", ""); // 获取文件扩展名 String fileExtension = trainTask.getEntrust_file().substring(trainTask.getEntrust_file().lastIndexOf(".") + 1); // 生成新的文件名 String newFileName = uuid + "." + fileExtension; filename = FileConstants.REACT_PREFIX + RuoYiConfig.getUploadPath() + newFileName; java.nio.file.Path path = java.nio.file.Paths.get(filename); File file = new File(filename); FileOutputStream out = new FileOutputStream(filename); out.write(buffer); out.close(); } catch (Exception e) { log.error("TAG", "异常信息:" + e.getMessage()); }