微信刷脸:无授权码
This commit is contained in:
parent
237cf8dbe3
commit
d9d73434f6
|
@ -11,46 +11,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "wx.mp")
|
@ConfigurationProperties(prefix = "dpkj.wx")
|
||||||
public class WxMpProperties {
|
public class WxMpProperties {
|
||||||
/**
|
|
||||||
* 是否使用redis存储access token
|
|
||||||
*/
|
|
||||||
private Boolean useRedis = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redis 配置
|
|
||||||
*/
|
|
||||||
private RedisConfig redisConfig;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class RedisConfig {
|
|
||||||
/**
|
|
||||||
* redis服务器 主机地址
|
|
||||||
*/
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redis服务器 端口号
|
|
||||||
*/
|
|
||||||
private Integer port;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redis服务器 密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redis 服务连接超时时间
|
|
||||||
*/
|
|
||||||
private Integer timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多个公众号配置信息
|
* 多个公众号配置信息
|
||||||
*/
|
*/
|
||||||
private List<MpConfig> configs;
|
private List<MpConfig> configs;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class MpConfig {
|
public static class MpConfig {
|
||||||
/**
|
/**
|
||||||
|
@ -126,48 +93,6 @@ public class WxMpProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 访问地址
|
|
||||||
*/
|
|
||||||
private MpUrl url;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class MpUrl {
|
|
||||||
/**
|
|
||||||
* H5地址
|
|
||||||
*/
|
|
||||||
private String h5;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口地址
|
|
||||||
*/
|
|
||||||
private String server;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模板消息id
|
|
||||||
*/
|
|
||||||
private MpTemplate template;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class MpTemplate {
|
|
||||||
/**
|
|
||||||
* 缴费通知
|
|
||||||
*/
|
|
||||||
private String payMsg;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程待办
|
|
||||||
*/
|
|
||||||
private String test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程待办
|
|
||||||
*/
|
|
||||||
private String test2;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信商户支付配置
|
* 微信商户支付配置
|
||||||
*/
|
*/
|
||||||
|
@ -250,4 +175,22 @@ public class WxMpProperties {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问地址
|
||||||
|
*/
|
||||||
|
private MpUrl url;
|
||||||
|
@Data
|
||||||
|
public static class MpUrl {
|
||||||
|
/**
|
||||||
|
* H5地址
|
||||||
|
*/
|
||||||
|
private String h5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口地址
|
||||||
|
*/
|
||||||
|
private String server;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -66,8 +67,6 @@ public class WxpayFaceTestController {
|
||||||
WxFacePayResp wxFacePayResp = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
WxFacePayResp wxFacePayResp = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
||||||
System.out.println("**************2、获取数据:"+wxFacePayResp.toString());
|
System.out.println("**************2、获取数据:"+wxFacePayResp.toString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String rawdata = wxFacePayResp.getRawdata();
|
String rawdata = wxFacePayResp.getRawdata();
|
||||||
return Result.ok(wxFacePayResp);
|
return Result.ok(wxFacePayResp);
|
||||||
}
|
}
|
||||||
|
@ -80,15 +79,17 @@ public class WxpayFaceTestController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/getWxpayfaceAuthinfo", method = RequestMethod.POST)
|
@RequestMapping(value = "/getWxpayfaceAuthinfo", method = RequestMethod.POST)
|
||||||
public Result<Map<String, Object>> getWxpayfaceAuthinfo() throws Exception {
|
public Result<Map<String, Object>> getWxpayfaceAuthinfo() throws Exception {
|
||||||
|
Map<String, Object> wxFacePayResp = new HashMap<>();
|
||||||
// 构建请求参数的JSON字符串
|
// 构建请求参数的JSON字符串
|
||||||
WxFacePayReq wxFacePayReq = new WxFacePayReq("getWxpayfaceRawdata","1",System.currentTimeMillis()/1000);
|
WxFacePayReq wxFacePayReq = new WxFacePayReq("getWxpayfaceRawdata","1",System.currentTimeMillis()/1000);
|
||||||
WxFacePayResp wxFacePayResp1 = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
WxFacePayResp wxFacePayResp1 = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
||||||
System.out.println("**************2、获取数据返回值:"+wxFacePayResp1.toString());
|
System.out.println("**************2、获取数据getWxpayfaceRawdata:"+wxFacePayResp1.toString());
|
||||||
String rawdata = wxFacePayResp1.getRawdata();
|
if("SUCCESS".equals(wxFacePayResp1.getReturn_code())){
|
||||||
|
String rawdata = wxFacePayResp1.getRawdata();
|
||||||
// 构建请求参数的JSON字符串
|
// 构建请求参数的JSON字符串
|
||||||
Map<String, Object> wxFacePayResp = weChatPayFaceService.getWxFaceAuthInfoReqMap(rawdata);
|
wxFacePayResp= weChatPayFaceService.getWxFaceAuthInfoReqMap(rawdata);
|
||||||
System.out.println("**************333:"+wxFacePayResp.toString());
|
System.out.println("**************2、获取调用凭证get_wxpayface_authinfo:"+wxFacePayResp.toString());
|
||||||
|
}
|
||||||
return Result.ok(wxFacePayResp);
|
return Result.ok(wxFacePayResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.sun.jna.Native;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description:
|
* @description: 32位的WxpayFaceSDK: /resources/win32-x86/WxpayFaceSDK.dll
|
||||||
* @author: Zhangxue
|
* @author: Zhangxue
|
||||||
* @time: 2025/4/17 17:02
|
* @time: 2025/4/17 17:02
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dpkj.modules.scanface.wx.service;
|
package com.dpkj.modules.scanface.wx.service;
|
||||||
|
|
||||||
|
|
||||||
import com.dpkj.modules.scanface.wx.dll.WxpayFaceSDKDll;
|
import com.dpkj.modules.scanface.wx.dll.WxpayFaceSDKDll;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
|
@ -56,15 +56,17 @@ public class CallWxpayFaceServiceImpl implements CallWxpayFaceService {
|
||||||
|
|
||||||
// 调用本地方法
|
// 调用本地方法
|
||||||
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
||||||
int result =dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
int result = dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||||
|
//使用C:\Windows\System32目录下 int result = WxpayFaceSDK.INSTANCE.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||||
resStr = new String(byteArray, StandardCharsets.UTF_8);
|
resStr = new String(byteArray, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
System.out.println("-----------调用服务成功结果: " + resStr);
|
System.out.println("-----------调用服务成功结果: " + resStr);
|
||||||
//释放
|
|
||||||
dll.wxpayReleaseResponse(new String[2]);
|
dll.wxpayReleaseResponse(new String[2]);
|
||||||
|
//释放 C:\Windows\System32目录下 WxpayFaceSDK.INSTANCE.wxpayReleaseResponse(new String[2]);
|
||||||
} else {
|
} else {
|
||||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||||
|
|
|
@ -51,11 +51,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||||
|
|
||||||
|
|
||||||
//赋值
|
//赋值
|
||||||
private static WxMpProperties wxMpProperties;
|
@Autowired
|
||||||
|
private WxMpProperties wxMpProperties;
|
||||||
public static void setWxMpConfiguration(WxMpProperties wxMpProperties) {
|
|
||||||
WeChatPayFaceServiceImpl.wxMpProperties = wxMpProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +90,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||||
// 调用本地方法
|
// 调用本地方法
|
||||||
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
||||||
int result = dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
int result = dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||||
|
|
||||||
|
//使用C:\Windows\System32目录下 int result = WxpayFaceSDK.INSTANCE.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||||
log.info("[WeChatPayFaceServiceImpl][doWxPayIniMethod][95] DLL 返回码: {}", result);
|
log.info("[WeChatPayFaceServiceImpl][doWxPayIniMethod][95] DLL 返回码: {}", result);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||||
|
@ -102,6 +101,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||||
System.out.println("-----------调用服务成功结果: " + resStr);
|
System.out.println("-----------调用服务成功结果: " + resStr);
|
||||||
//释放
|
//释放
|
||||||
dll.wxpayReleaseResponse(new String[2]);
|
dll.wxpayReleaseResponse(new String[2]);
|
||||||
|
|
||||||
|
//释放 C:\Windows\System32目录下 WxpayFaceSDK.INSTANCE.wxpayReleaseResponse(new String[2]);
|
||||||
} else {
|
} else {
|
||||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||||
|
|
|
@ -42,6 +42,50 @@ dpkj:
|
||||||
partner-id: 2088641941653700
|
partner-id: 2088641941653700
|
||||||
# 核心入参 serviceId
|
# 核心入参 serviceId
|
||||||
service-id: pay
|
service-id: pay
|
||||||
|
#微信模块
|
||||||
|
wx:
|
||||||
|
configs: #清研家
|
||||||
|
- app-id: wxe8334dd2140bb0e1
|
||||||
|
# 公众号的appsecret
|
||||||
|
secret: f83420d79cc6ecd1d7fe9684ac9cdfe4
|
||||||
|
# 接口配置里的Token值
|
||||||
|
token: dpkjylwjvote
|
||||||
|
# 接口配置里的EncodingAESKey值
|
||||||
|
aes-key: go2uM3ASe2rEyeoNsZHoPCiKGgpku0Bi49P5IypdQWT
|
||||||
|
mch-config: #商户信息 清研家关联的商户:驿路万家-扬州清研软件科技
|
||||||
|
app-id: wxe8334dd2140bb0e1
|
||||||
|
secret: f83420d79cc6ecd1d7fe9684ac9cdfe4
|
||||||
|
#调用接口所需service_id
|
||||||
|
service-id: service_id
|
||||||
|
#商户号
|
||||||
|
mch-id: 1557642321
|
||||||
|
#商户秘钥
|
||||||
|
mch-key: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#报文解密 APIv3密钥
|
||||||
|
v3-key: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#微信: 商户APIv2密钥
|
||||||
|
key-api: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath;开头)
|
||||||
|
key-path: classpath:test\apiclient_cert.p12
|
||||||
|
private-key-path: classpath:test\apiclient_key.pem
|
||||||
|
private-cert-path: classpath:test\apiclient_cert.pem
|
||||||
|
#微信:商家api序列号
|
||||||
|
mch-serial-no:
|
||||||
|
#JSAPI--公众号支付 NATIVE--原生扫码支付 APP--app支付
|
||||||
|
trade-type: JSAPI
|
||||||
|
trade-type-native: NATIVE
|
||||||
|
#支付回调方法地址
|
||||||
|
pay-notify-url: ${dpkj.url.server-url}/openapi/wxPayOrderApi/notify
|
||||||
|
#退款回调方法地址
|
||||||
|
refund-notify-url: ${dpkj.url.server-url}/openapi/wxPayOrderApi/refundNotify
|
||||||
|
# 路径
|
||||||
|
url:
|
||||||
|
# 后端接口地址
|
||||||
|
# server: https://102760424tfyw.vicp.fun/api
|
||||||
|
server: ${dpkj.url.server-url}
|
||||||
|
# h5地址
|
||||||
|
h5: ${dpkj.url.h5-url}
|
||||||
|
|
||||||
|
|
||||||
# 自定义app参数
|
# 自定义app参数
|
||||||
app:
|
app:
|
||||||
|
|
|
@ -43,6 +43,49 @@ dpkj:
|
||||||
partner-id: 2088641941653700
|
partner-id: 2088641941653700
|
||||||
# 核心入参 serviceId
|
# 核心入参 serviceId
|
||||||
service-id: pay
|
service-id: pay
|
||||||
|
#微信模块
|
||||||
|
wx:
|
||||||
|
configs: # 清研家
|
||||||
|
- app-id: wxc12fa4977f66974d #wxc12fa4977f66974d #wx024903d1d2e1a55a
|
||||||
|
# 公众号的appsecret
|
||||||
|
secret: a51dbcac25a73d7e4812a43cf550c5fc #f83420d79cc6ecd1d7fe9684ac9cdfe4
|
||||||
|
# 接口配置里的Token值 DPKJ-YINYITONG #DPKJ-YINYITONG#dpkjylwjvote
|
||||||
|
token: DPKJ-YINYITONG
|
||||||
|
# 接口配置里的EncodingAESKey值
|
||||||
|
aes-key: yIBgBrHwRGjO2L3CLIE9hmnlf1FrXQQ7qJZVIg4r6Dx
|
||||||
|
mch-config: #商户信息 驿路万家-扬州清研软件科技
|
||||||
|
app-id: wxc12fa4977f66974d
|
||||||
|
secret: f83420d79cc6ecd1d7fe9684ac9cdfe4
|
||||||
|
#调用接口所需service_id
|
||||||
|
service-id: service_id
|
||||||
|
#商户号
|
||||||
|
mch-id: 1557642321
|
||||||
|
#商户秘钥
|
||||||
|
mch-key: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#报文解密 APIv3密钥
|
||||||
|
v3-key: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#微信: 商户APIv2密钥
|
||||||
|
key-api: yndpkj15288216506YndpkjKsjytZx12
|
||||||
|
#p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath;开头)
|
||||||
|
key-path: classpath:test\apiclient_cert.p12
|
||||||
|
private-key-path: classpath:test\apiclient_key.pem
|
||||||
|
private-cert-path: classpath:test\apiclient_cert.pem
|
||||||
|
#微信:商家api序列号
|
||||||
|
mch-serial-no:
|
||||||
|
#JSAPI--公众号支付 NATIVE--原生扫码支付 APP--app支付
|
||||||
|
trade-type: JSAPI
|
||||||
|
trade-type-native: NATIVE
|
||||||
|
#支付回调方法地址
|
||||||
|
pay-notify-url: ${dpkj.url.server-url}/openapi/wxPayOrderApi/notify
|
||||||
|
#退款回调方法地址
|
||||||
|
refund-notify-url: ${dpkj.url.server-url}/openapi/wxPayOrderApi/refundNotify
|
||||||
|
# 路径
|
||||||
|
url:
|
||||||
|
# 后端接口地址
|
||||||
|
# server: https://102760424tfyw.vicp.fun/api
|
||||||
|
server: ${dpkj.url.server-url}
|
||||||
|
# h5地址
|
||||||
|
h5: ${dpkj.url.h5-url}
|
||||||
|
|
||||||
# 自定义app参数
|
# 自定义app参数
|
||||||
app:
|
app:
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue