From c23bccf7f39ebae903cc20d255b014d3e80c0221 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 06 十一月 2019 18:50:04 +0800
Subject: [PATCH] 红包H5接口修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java |   75 ++++++++++++++++++-------------------
 1 files changed, 37 insertions(+), 38 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 d654186..8fa984d 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
@@ -21,6 +21,7 @@
 import com.yeshi.fanli.util.FileUtil;
 import com.yeshi.fanli.util.ImageUtil;
 import com.yeshi.fanli.util.StringUtil;
+import com.yeshi.fanli.util.UserInviteUtil;
 
 @Service
 public class QrCodeServiceImpl implements QrCodeService {
@@ -131,21 +132,21 @@
 		}
 		return null;
 	}
-	
-	
+
 	@Override
-	public String drawInviteQrCodeNew(String url, Long uid, String portrait, Integer pX, Integer pY, Integer size, 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;
 		}
-		
+
 		String targetPath = null;
 		String erCodeTempPath = null;
-		InputStream erCodeInputStream  = null; // 浜岀淮鐮�
+		InputStream erCodeInputStream = null; // 浜岀淮鐮�
 		InputStream portraitInputStream = null; // 澶村儚
 		InputStream urlInputStream = HttpUtil.getAsInputStream(url); // 鑳屾櫙
-		
+
 		String uuid = UUID.randomUUID().toString().replace("-", "");
 		if (uid == null) {
 			targetPath = FileUtil.getCacheDir() + "/share_" + uuid + "_" + System.currentTimeMillis() + ".jpg";
@@ -155,44 +156,43 @@
 			erCodeInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official.png");
 			// 瀹樻柟榛樿澶村儚
 			portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
-		
+
 		} else {
-		
+
 			targetPath = FileUtil.getCacheDir() + "/share_" + uid + "_" + System.currentTimeMillis() + ".jpg";
 			erCodeTempPath = FileUtil.getCacheDir() + "/" + uid + "_" + System.currentTimeMillis() + ".jpg";
-	
-			String erCode = ("http://" + Constant.wxGZConfig.getLoginHost() + "/"
-					+ Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
+
+			String erCode = UserInviteUtil.getShareUrl(uid);
 			// 鐢熸垚
 			try {
 				QRCodeUtil.getInstance(250).encode(erCode, erCodeTempPath);
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
-	
+
 			urlInputStream = HttpUtil.getAsInputStream(url); // 鑳屾櫙
 			portraitInputStream = HttpUtil.getAsInputStream(portrait); // 澶村儚
 			erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 浜岀淮鐮�
 		}
-		
+
 		// 寮�濮嬫牴鎹� url(鑳屾櫙鍥�), qrCode(浜岀淮鐮�), portrait(澶村儚) 鐢熸垚鍥剧墖
-		ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath,
-			 pX, pY, size, inviteCode);
-		
+		ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, pX, pY,
+				size, inviteCode);
+
 		// 鍒犻櫎浜岀淮鐮佹枃浠�
-		if(erCodeInputStream != null) {
+		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;
+			String fileUrl = null;
 			if (uid == null) {
 				fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
 			} else {
@@ -201,7 +201,7 @@
 
 			// 涓婁紶鏂囦欢
 			String imgUrl = COSManager.getInstance().uploadFile(new File(targetPath), fileUrl).getUrl();
-			
+
 			// 鍒犻櫎鏈湴缂撳瓨鏂囦欢
 			new File(targetPath).delete();
 
@@ -209,21 +209,21 @@
 		}
 		return null;
 	}
-	
+
 	@Override
-	public String drawInviteToGreet(String url, Long uid, String portrait, String inviteCode, String content, 
-			Date date) throws IOException {
-		
+	public String drawInviteToGreet(String url, Long uid, String portrait, String inviteCode, String content, Date date)
+			throws IOException {
+
 		if (StringUtil.isNullOrEmpty(url)) {
 			return null;
 		}
 
 		String targetPath = null;
 		String erCodeTempPath = null;
-		InputStream erCodeInputStream  = null; // 浜岀淮鐮�
+		InputStream erCodeInputStream = null; // 浜岀淮鐮�
 		InputStream portraitInputStream = null; // 澶村儚
 		InputStream urlInputStream = HttpUtil.getAsInputStream(url); // 鑳屾櫙
-		
+
 		String uuid = UUID.randomUUID().toString().replace("-", "");
 		if (uid == null) {
 			targetPath = FileUtil.getCacheDir() + "/share_" + uuid + "_" + System.currentTimeMillis() + ".jpg";
@@ -233,7 +233,7 @@
 			erCodeInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official.png");
 			// 瀹樻柟榛樿澶村儚
 			portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
-		
+
 		} else {
 			targetPath = FileUtil.getCacheDir() + "/share_" + uid + "_" + System.currentTimeMillis() + ".jpg";
 			erCodeTempPath = FileUtil.getCacheDir() + "/" + uid + "_" + System.currentTimeMillis() + ".jpg";
@@ -245,23 +245,22 @@
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
-			erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); 
+			erCodeInputStream = new FileInputStream(new File(erCodeTempPath));
 			portraitInputStream = HttpUtil.getAsInputStream(portrait); // 澶村儚
 		}
-		
-		
-		// 寮�濮嬫牴鎹� url(鑳屾櫙鍥�), qrCode(浜岀淮鐮�), portrait(澶村儚) 鐢熸垚鍥剧墖
-		ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode, content, date);
 
-		
+		// 寮�濮嬫牴鎹� url(鑳屾櫙鍥�), qrCode(浜岀淮鐮�), portrait(澶村儚) 鐢熸垚鍥剧墖
+		ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode,
+				content, date);
+
 		// 鍒犻櫎浜岀淮鐮佹枃浠�
-		if(erCodeInputStream != null) {
+		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("/");
@@ -269,7 +268,7 @@
 			String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
 
 			// 涓婁紶鏂囦欢鐩稿浣嶇疆
-			String fileUrl= null;
+			String fileUrl = null;
 			if (uid == null) {
 				fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
 			} else {
@@ -282,7 +281,7 @@
 			new File(targetPath).delete();
 
 			return imgUrl;
-		} 
+		}
 		return null;
 	}
 

--
Gitblit v1.8.0