装册管理-条码无法扫出

new
parent df09c16e7c
commit b1978bb176

@ -149,18 +149,22 @@ public class PackagesServiceImpl implements PackagesService {
* @return * @return
*/ */
private String getUrl(PackagesDO packages){ private String getUrl(PackagesDO packages){
try {
// InetAddress address = InetAddress.getLocalHost();//获取的是本地的IP地址 // InetAddress address = InetAddress.getLocalHost();//获取的是本地的IP地址
// String hostAddress = address.getHostAddress(); // 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"); "./tmp/Packages/" + packages.getCaseNum()+"-"+ packages.getCatalogNum()+"-"+ packages.getFilesNum() + ".png");
MultipartFile file = FileUtils.getMultipartFile(buf); MultipartFile file = FileUtils.getMultipartFile(buf);
String url=""; String url= null;
url = fileService.createFile(null, null, IoUtil.readBytes(file.getInputStream())); try {
url = fileService.createFile(file.getOriginalFilename(), null, IoUtil.readBytes(file.getInputStream()));
return url; return url;
} catch (IOException e) { } catch (IOException e) {
Log.error(e.toString()); Log.error(e.toString());
return ""; return null;
}finally {
if(buf!=null && buf.exists()){
FileUtils.deleteFile(buf.getAbsolutePath());
}
} }
} }

Loading…
Cancel
Save