From 22d199559342c1ccb3a0a8a5b5ee50e973819e16 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期五, 19 一月 2024 11:31:19 +0800
Subject: [PATCH] Merge branch 'master-prod-new' into chenjiahe-再生俱乐部

---
 phi_platform_user/src/main/java/com/hx/phip/controller/mp/MpQrCodeController.java |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/phi_platform_user/src/main/java/com/hx/phip/controller/mp/MpQrCodeController.java b/phi_platform_user/src/main/java/com/hx/phip/controller/mp/MpQrCodeController.java
index faa6605..46a071b 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/controller/mp/MpQrCodeController.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/controller/mp/MpQrCodeController.java
@@ -1,18 +1,21 @@
 package com.hx.phip.controller.mp;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.hx.common.BaseController;
 import com.hx.exception.TipsException;
-import com.hx.mp.util.MPWeixinBaseUtil;
 import com.hx.phiappt.common.QrCodeConstants;
+import com.hx.phiappt.model.BaseEntity;
 import com.hx.phip.common.wx.corp.WeiXinMpUtil;
 import com.hx.phip.config.CustomParameter;
 import com.hx.phip.model.ApplyParameter;
 import com.hx.phip.model.SysParameter;
 import com.hx.phip.tool.ApplyParameterTool;
 import com.hx.util.AesUtil;
-import com.hx.util.HttpServletRequestUtil;
+import com.hx.util.QRCodeUtil;
 import com.hx.util.StringUtils;
+import com.hx.util.corp.CorpMpUtil;
+import com.hx.util.corp.entity.AppLetInfo;
 import com.hz.his.dto.mp.MpQrCodeDto;
 import com.platform.constants.PlatformPattern;
 import com.platform.exception.PlatTipsException;
@@ -20,16 +23,12 @@
 import com.platform.resultTool.PlatformResult;
 import com.platform.resultTool.SystemCode;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.io.FileUtils;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.io.File;
 
 
 /**
@@ -72,16 +71,30 @@
         }
 
 
-        String sence = QrCodeConstants.PREFIX_HIS_CODE + "_" + mpQrCodeDto.getCiq() + "_" + mpQrCodeDto.getShopCode();
+        String scene = QrCodeConstants.PREFIX_HIS_CODE + "_" + mpQrCodeDto.getCiq() + "_" + mpQrCodeDto.getShopCode();
 
         String imgUrl = null;
         try {
 
+            String version = "trial";
+
+            if(PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
+                version = "release";
+            }
             //鑾峰彇token鍊�
             SysParameter sysParameter = getMpToken(HiSMPAPPID);
 
-            File file = MPWeixinBaseUtil.createUnlimitQrCode(sysParameter.getParamValue(), sence, "package_medical_guide/wb_visit/visitAdd",430, false, null, false);
-            if (file.length() < 300) {
+            //data.put("senceCode",sence);
+            //File file = MPWeixinBaseUtil.createUnlimitQrCode(sysParameter.getParamValue(), scene, "package_medical_guide/wb_visit/visitAdd",430, false, null, false);
+            //鐢熸垚灏忕▼搴忛摼鎺�
+            AppLetInfo appLetInfo = CorpMpUtil.getAppLetUrl("/package_medical_guide/wb_visit/visitAdd", sysParameter.getParamValue(), version, "scene="+scene);
+            log.info("杩斿洖灏忕▼搴忛摼鎺ユ暟鎹細{}", JSON.toJSONString(appLetInfo));
+            if (appLetInfo.getErrcode().equals(BaseEntity.NO)) {
+                //杞崲涓烘櫘閫氫簩缁寸爜
+                 imgUrl = QRCodeUtil.QRCodeCreate(appLetInfo.getUrlLink(), 430, null);
+            }
+
+   /*         if (file.length() < 300) {
                 throw new TipsException("璺宠浆閾炬帴涓嶆纭紒");
             }
             // 鐩存帴杩斿洖鍥剧墖鏂囦欢璺緞
@@ -90,7 +103,7 @@
             // 鎴栬�呰鍙栧浘鐗囨枃浠跺瓧鑺�,base64缂栫爜,杩斿洖Data URI
             byte[] imgData = FileUtils.readFileToByteArray(file);
             String imgBase64 = Base64.encodeBase64String(imgData);
-            imgUrl = "data:image/jpeg;base64," + imgBase64;
+            imgUrl = "data:image/jpeg;base64," + imgBase64;*/
         } catch (Exception e) {
             throw new TipsException(e.getMessage());
         }

--
Gitblit v1.8.0