|
|
@ -2,7 +2,6 @@ package com.ynxbd.wx.pwe; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ynxbd.common.helper.common.CodeHelper; |
|
|
|
import com.ynxbd.common.helper.common.CodeHelper; |
|
|
|
import com.ynxbd.common.helper.common.JsonHelper; |
|
|
|
|
|
|
|
import com.ynxbd.common.helper.common.URLHelper; |
|
|
|
import com.ynxbd.common.helper.common.URLHelper; |
|
|
|
import com.ynxbd.common.helper.http.OkHttpHelper; |
|
|
|
import com.ynxbd.common.helper.http.OkHttpHelper; |
|
|
|
import com.ynxbd.common.result.ServiceException; |
|
|
|
import com.ynxbd.common.result.ServiceException; |
|
|
@ -12,7 +11,6 @@ import org.apache.commons.lang3.ObjectUtils; |
|
|
|
import javax.crypto.Mac; |
|
|
|
import javax.crypto.Mac; |
|
|
|
import javax.crypto.spec.SecretKeySpec; |
|
|
|
import javax.crypto.spec.SecretKeySpec; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.io.BufferedReader; |
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -69,11 +67,17 @@ public class PWEHelper { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param registerId 挂号ID(商户订单号 outTradeNo) |
|
|
|
* @param registerId 挂号ID(商户订单号 outTradeNo) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static String getH5PWEUrl(String registerId) { |
|
|
|
public static String getH5PWEUrl(String registerId, String openid) { |
|
|
|
log.info("[患者端]获取预问诊h5链接 registerId={}", registerId); |
|
|
|
log.info("[患者端]获取预问诊h5链接 registerId={}", registerId); |
|
|
|
String registerIdSign = toHmacSha256Example(PWEConfig.SECRET_KEY, (PWEConfig.HOSPITAL_ID + registerId)); |
|
|
|
String registerIdSign = toHmacSha256Example(PWEConfig.SECRET_KEY, (PWEConfig.HOSPITAL_ID + registerId)); |
|
|
|
if (ObjectUtils.isEmpty(registerIdSign)) { |
|
|
|
if (ObjectUtils.isEmpty(registerIdSign)) { |
|
|
|
log.error("签名失败"); |
|
|
|
log.error("[患者端]获取预问诊h5链接,签名失败"); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 测试环境,并且未找到用户
|
|
|
|
|
|
|
|
if (PWEConfig.IS_DEV && !PWEConfig.hasOpenId(openid)) { |
|
|
|
|
|
|
|
log.error("[患者端]测试环境未找到用户 openid={}", openid); |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
String params = URLHelper.mapToUrl(map -> { |
|
|
|
String params = URLHelper.mapToUrl(map -> { |
|
|
|
map.put("partnerId", PWEConfig.PARTNER_ID); |
|
|
|
map.put("partnerId", PWEConfig.PARTNER_ID); |
|
|
|