diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java index e04f0488..3dc9a1a9 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java @@ -149,18 +149,22 @@ public class PackagesServiceImpl implements PackagesService { * @return */ private String getUrl(PackagesDO packages){ - try { // InetAddress address = InetAddress.getLocalHost();//获取的是本地的IP地址 // String hostAddress = address.getHostAddress(); - File buf = BarcodeUtil.generateBarCode(webUrl+"/info?codeValue="+packages.getCaseNum()+"-"+ packages.getCatalogNum()+"-"+ packages.getFilesNum(), "QR_CODE", + File buf = BarcodeUtil.generateBarCode(packages.getCaseNum()+"-"+ packages.getCatalogNum()+"-"+ packages.getFilesNum(), "QR_CODE", "./tmp/Packages/" + packages.getCaseNum()+"-"+ packages.getCatalogNum()+"-"+ packages.getFilesNum() + ".png"); MultipartFile file = FileUtils.getMultipartFile(buf); - String url=""; - url = fileService.createFile(null, null, IoUtil.readBytes(file.getInputStream())); + String url= null; + try { + url = fileService.createFile(file.getOriginalFilename(), null, IoUtil.readBytes(file.getInputStream())); return url; } catch (IOException e) { Log.error(e.toString()); - return ""; + return null; + }finally { + if(buf!=null && buf.exists()){ + FileUtils.deleteFile(buf.getAbsolutePath()); + } } }