|
|
|
@ -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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|