From ff942c3f9f6fe84f6d141c87f47e58bf70273d40 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期五, 24 五月 2019 15:13:42 +0800
Subject: [PATCH] 动态 二维码样式修改  已下架商品不提供分享

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java |   53 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
index 119389b..e895c86 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
@@ -134,7 +134,7 @@
 	
 	
 	@Override
-	public String drawInviteQrCodeNew(String url, Long uid, String portrait, String inviteCode) throws IOException {
+	public String drawInviteQrCodeNew(String url, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws IOException {
 		
 		if (StringUtil.isNullOrEmpty(url)) {
 			return null;
@@ -174,28 +174,36 @@
 			portraitInputStream = HttpUtil.getAsInputStream(portrait); // 澶村儚
 			erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 浜岀淮鐮�
 		}
+		
 		// 寮�濮嬫牴鎹� url(鑳屾櫙鍥�), qrCode(浜岀淮鐮�), portrait(澶村儚) 鐢熸垚鍥剧墖
-		ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode);
-
+		ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath,
+			 pX, pY, size, inviteCode);
+		
+		// 鍒犻櫎浜岀淮鐮佹枃浠�
+		if(erCodeInputStream != null) {
+			erCodeInputStream.close();
+		}
+		if (erCodeTempPath != null && new File(erCodeTempPath).exists()) {
+			new File(erCodeTempPath).delete();
+		}
+		
+		// 涓婁紶鏂囦欢鐩稿浣嶇疆
 		if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
-			
 			int index = url.lastIndexOf("/");
 			String newUrl = url.substring(index + 1);
 			String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
-
 			String fileUrl= null;
 			if (uid == null) {
-				fileUrl= "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
+				fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
 			} else {
-				
 				fileUrl = "ercode/" + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
-				if (new File(erCodeTempPath).exists())
-					new File(erCodeTempPath).delete();
 			}
-			
+
+			// 涓婁紶鏂囦欢
 			String imgUrl = COSManager.getInstance().uploadFile(new File(targetPath), fileUrl).getUrl();
-			if (new File(targetPath).exists())
-				new File(targetPath).delete();
+			
+			// 鍒犻櫎鏈湴缂撳瓨鏂囦欢
+			new File(targetPath).delete();
 
 			return imgUrl;
 		}
@@ -245,6 +253,15 @@
 		// 寮�濮嬫牴鎹� url(鑳屾櫙鍥�), qrCode(浜岀淮鐮�), portrait(澶村儚) 鐢熸垚鍥剧墖
 		ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode, content, date);
 
+		
+		// 鍒犻櫎浜岀淮鐮佹枃浠�
+		if(erCodeInputStream != null) {
+			erCodeInputStream.close();
+		}
+		if (erCodeTempPath != null && new File(erCodeTempPath).exists()) {
+			new File(erCodeTempPath).delete();
+		}
+		
 		// 涓婁紶鏂囦欢
 		if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
 			int index = url.lastIndexOf("/");
@@ -254,22 +271,18 @@
 			// 涓婁紶鏂囦欢鐩稿浣嶇疆
 			String fileUrl= null;
 			if (uid == null) {
-				fileUrl= "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
+				fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
 			} else {
-				
 				fileUrl = "ercode/" + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
-				if (new File(erCodeTempPath).exists())
-					new File(erCodeTempPath).delete();
 			}
 
+			// 涓婁紶
 			String imgUrl = COSManager.getInstance().uploadFile(new File(targetPath), fileUrl).getUrl();
-			
-			if (new File(targetPath).exists())
-				new File(targetPath).delete();
+			// 鍒犻櫎缂撳瓨鏂囦欢
+			new File(targetPath).delete();
 
 			return imgUrl;
 		} 
-		
 		return null;
 	}
 

--
Gitblit v1.8.0