From ad31648c6f7a8bff1f7ccdf84b76006b9ffb78f8 Mon Sep 17 00:00:00 2001 From: jyy <jyy> Date: Sat, 17 Jul 2021 15:59:10 +0800 Subject: [PATCH] 1. 新增套餐中有效和无效的操作 2. 会员修改门店功能 3. 套餐新增编辑次数功能 4. 计算是否为赠送的条件为,全部为赠送金额购买且支付金额大于0 5. 打印小票功能调整间距,和收银人 6. PC端服务单新增划扣金额展示 --- zq-erp/src/main/java/com/matrix/component/tools/ImageUtil.java | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 44 insertions(+), 2 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/component/tools/ImageUtil.java b/zq-erp/src/main/java/com/matrix/component/tools/ImageUtil.java index c7fdbdb..d6966a2 100644 --- a/zq-erp/src/main/java/com/matrix/component/tools/ImageUtil.java +++ b/zq-erp/src/main/java/com/matrix/component/tools/ImageUtil.java @@ -2,8 +2,10 @@ import java.awt.*; import java.awt.image.BufferedImage; -import java.io.FileNotFoundException; -import java.io.IOException; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -91,4 +93,44 @@ System.out.println("系统字体数:" + fontCount); } + + public static void downloadPicture(String imgUrl,String savePath) { + URL url = null; + int imageNumber = 0; + try { + + InputStream inputStream = null; + HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(imgUrl).openConnection(); + httpURLConnection.setRequestMethod("GET"); + httpURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"); + httpURLConnection.setRequestProperty("Accept-Encoding", "gzip"); + httpURLConnection.setRequestProperty("Referer","no-referrer"); + httpURLConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); + httpURLConnection.setConnectTimeout(15000); + httpURLConnection.setReadTimeout(20000); + inputStream = httpURLConnection.getInputStream(); + + + + FileOutputStream fileOutputStream = new FileOutputStream(new File(savePath)); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inputStream.read(buffer)) > 0) { + output.write(buffer, 0, length); + } + byte[] context=output.toByteArray(); + fileOutputStream.write(output.toByteArray()); + inputStream.close(); + fileOutputStream.close(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + + } -- Gitblit v1.9.1