解决生成订单时key不能为null错误
This commit is contained in:
parent
54ddf8ce5b
commit
c60724520c
@ -0,0 +1,28 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7qoMuXZlPUa61
|
||||||
|
MTR8mQynzeMSWso32DQRTei+f7z87IxH24So5Y3BIkDfauQZN9Fq1Br+gcwSZ5Pf
|
||||||
|
WGVBRar7Ci9ucL5fjyscH3KoTrToX4BKXC/7u0ZOn21wWjoxS6Ub6z01Eniqj1nS
|
||||||
|
SXRst3+b691h6JXWodUPLfI4GWaUeeep8rBSFMMRT0UJWmZ7JSyyQwRfH47Z2vJR
|
||||||
|
dwQyvueqf6zH1KCT8+t1v8/kqPFNN+9jH3FE7NvW4HEteU+wVZZKi1da9bkN8x26
|
||||||
|
xFA8WUbcKzh14kThNv2gAwH1Kjk2OfJsQCfyr+JVEM1KNQ6Gqg6tqIEBAKbGQsbf
|
||||||
|
PsA/UQTZAgMBAAECggEAaKQwV2creDYEo9XW/W7dxqef6Pkk7rSoe8mkcKyLdcB0
|
||||||
|
jBDUTNULENkHsUxJ+eHM7LNuheFcKBsHMi947kdpimdogT1ueZw8HodOiJiyeSvf
|
||||||
|
PhdfTg9jqa1t+YrmDdyvKP0nePNew0QBgqcguwoqpoeDPvfQrQg55Cfreup272x/
|
||||||
|
mBxThDSr4zhNbMdh7jyPdvlEZKYsZ/l6jVjBWzNzRcrpctO/JhUmbnFXbKWFdMbT
|
||||||
|
8hE0+6bwNCteMx2y2YJMm3djaEONzJSMnI2gk6jcriPPZ813FPqppSok7yOT8oQ0
|
||||||
|
tyDT3KBgMzOPy4N+unurDGY2Splmz7jQFDh15ksYMQKBgQD5EDAKGGHSs4e4/0Rc
|
||||||
|
WsDe5QkjxOKmVsIdIfB58RQL6B6Bkje+EjSdLiOm0NEa0Yf/bK6jIloablKopjDm
|
||||||
|
ApKU2oWyPM6rQWOwxk0OAXF/wIEyCSWxfneCyU0yXgZeSpUrH/5jQcjjbIBGKfzq
|
||||||
|
9rIbptVFBuWDhZM1FOeAgng2fQKBgQDA5JCncMulf/jDRQ8tHxQPAhO5HtGrIufx
|
||||||
|
7+2OpjQ0McA3jD9wd2QiIJPGn4EKJW8o8higl/iYPJVqqoVeD/EoG/pN1uEh0dcF
|
||||||
|
GTb50BOGPp/5uDbV6AV3hPN8dGyrTcZeNPP3Ri/MK8T8ETYrLzh3O6MqQvNmYo9N
|
||||||
|
xjfEAlyqjQKBgDB0U8RDBhUF1GvLTbNh/I/goyyQSz/tNQqR5cTzf+DpIbY3ihyy
|
||||||
|
UgYaSdlUWroK9ZhdvoQCVOE7gV1KJ803xuiqssQATHzI1eo4Shllcn1WKExhtzGW
|
||||||
|
1w1cuGYKINcLT4X6TXVmAP0tyK7d0FSt9eynQmqRculpfUAgdwFrYJPJAoGAJyj/
|
||||||
|
+Q5cObA+V55Yk2eA0f8w898+38iJYEO+bbxuUr5a8KwHYRTL/mWwup09PEsXQy/L
|
||||||
|
MidIL9f02Z/ezZbc9bCgY1chg5UvWviggZztqc5i+fadI1YkbfxO1lBok2qJwCxt
|
||||||
|
7yCPqZqlNitkXOYMR6CS4oyPD5Uo1LhOL/vuxi0CgYEAzK25niNQc5EVPRYJ/J0w
|
||||||
|
5tqleGpnO/s4iZZAt67hJhovufdP7BobX/I4sEMEjDmSea/u4+RiRLlRB0Czartl
|
||||||
|
a6H7k3oE7EkFtkIpI4cuxo2AL59mkZ7YtRCmbtgWQPaOM7wlAY1QgVx50Z2GOUVR
|
||||||
|
DnXAVDmCIxqjIF2A/M7syN4=
|
||||||
|
-----END PRIVATE KEY-----
|
@ -56,22 +56,7 @@ import static com.fastbee.rechargecard.service.impl.UserWechatPayServiceImpl.api
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/pay")
|
@RequestMapping("/pay")
|
||||||
public class WeChatPayController extends BaseController {
|
public class WeChatPayController extends BaseController {
|
||||||
/** 商户号 */
|
|
||||||
public static String mchId = "1531795301";
|
|
||||||
/** 商户API私钥文件路径 */
|
|
||||||
public static String privateKeyPath = "fastbee-common/src/main/java/com/fastbee/common/utils/pay/apiclient_key.pem";
|
|
||||||
/** 商户API证书序列号 */
|
|
||||||
public static String serial_no = "3075B63EF52666EDC3EAFC5D4FB35C02CE123A9C";
|
|
||||||
/** 商户APIV3密钥 */
|
|
||||||
public static String apiV3Key = "e85a203e8ca146102f5cd7ecff912580";
|
|
||||||
//微信小程序appid
|
|
||||||
public static String appId="wx308612d2a8423311";
|
|
||||||
//请求随机串
|
|
||||||
public static String nonce_str="";
|
|
||||||
//时间戳
|
|
||||||
public static String timeStamp="";
|
|
||||||
// 使用HttpClientBuilder创建CloseableHttpClient实例,采用默认配置
|
|
||||||
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private INgUserRechargeRecordsService ngUserRechargeRecordsService;
|
private INgUserRechargeRecordsService ngUserRechargeRecordsService;
|
||||||
|
@ -167,7 +167,7 @@ public class UserRechargeCardsServiceImpl implements IUserRechargeCardsService
|
|||||||
|
|
||||||
param.put("data",data);
|
param.put("data",data);
|
||||||
try{
|
try{
|
||||||
//pubMqttClient.publish(1,true,topic, JSONUtil.toJsonStr(param));
|
pubMqttClient.publish(1,true,topic, JSONUtil.toJsonStr(param));
|
||||||
}catch (Exception e)
|
}catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception("消息发布失败");
|
throw new Exception("消息发布失败");
|
||||||
|
@ -49,7 +49,7 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
|
|||||||
//public static String publicKeyPath="fastbee-common/src/main/java/com/fastbee/common/utils/pay/wechat_public_key.pem";
|
//public static String publicKeyPath="fastbee-common/src/main/java/com/fastbee/common/utils/pay/wechat_public_key.pem";
|
||||||
//public static String publicKeyPath="fastbee-common/src/main/java/com/fastbee/common/utils/pay/wechat_public_key.pem";
|
//public static String publicKeyPath="fastbee-common/src/main/java/com/fastbee/common/utils/pay/wechat_public_key.pem";
|
||||||
//支付结果回调地址
|
//支付结果回调地址
|
||||||
public static String notify_url="https://3e744f6.r3.cpolar.cn/pay/getresult";//https://3e744f6.r3.cpolar.cn
|
public static String notify_url="https://5f655ed0.r3.cpolar.cn/pay/getresult";//https://5f655ed0.r3.cpolar.cn
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
* 创建订单,获取prepay_id和paySign
|
* 创建订单,获取prepay_id和paySign
|
||||||
@ -76,7 +76,7 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
|
|||||||
reqdata.put("mchid",mchId);
|
reqdata.put("mchid",mchId);
|
||||||
reqdata.put("description",recharge.getCardnumber()+recharge.getAmount().toString());
|
reqdata.put("description",recharge.getCardnumber()+recharge.getAmount().toString());
|
||||||
reqdata.put("out_trade_no",recharge.getRechargeCode());
|
reqdata.put("out_trade_no",recharge.getRechargeCode());
|
||||||
reqdata.put("notify_url","https://46b411f6.r3.cpolar.cn/pay/getresult");//"\t\n" +
|
reqdata.put("notify_url",notify_url);//"\t\n" +
|
||||||
reqdata.put("payer",payer);
|
reqdata.put("payer",payer);
|
||||||
//String Signature=getSign(reqdata);
|
//String Signature=getSign(reqdata);
|
||||||
Map<String,String> info=getSign(reqdata);
|
Map<String,String> info=getSign(reqdata);
|
||||||
@ -215,13 +215,13 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
|
|||||||
//String url = String.format("https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code", appId, appSecret, code);
|
//String url = String.format("https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code", appId, appSecret, code);
|
||||||
//String url="https://api.weixin.qq.com/sns/oauth2/access_token?appid="+appId+"&secret="+appSecret+"&code="+code+"&grant_type=authorization_code";
|
//String url="https://api.weixin.qq.com/sns/oauth2/access_token?appid="+appId+"&secret="+appSecret+"&code="+code+"&grant_type=authorization_code";
|
||||||
String url="https://api.weixin.qq.com/sns/jscode2session?appid="+appId+"&secret="+appSecret+"&js_code="+code+"&grant_type=authorization_code";
|
String url="https://api.weixin.qq.com/sns/jscode2session?appid="+appId+"&secret="+appSecret+"&js_code="+code+"&grant_type=authorization_code";
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
//RestTemplate restTemplate = new RestTemplate();
|
||||||
Map<String, String> response = restTemplate.getForObject(url, Map.class);
|
//Map<String, Object> response = restTemplate.getForObject(url, Map.class);
|
||||||
|
|
||||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||||
HttpGet httpGet = new HttpGet(url);
|
HttpGet httpGet = new HttpGet(url);
|
||||||
try (CloseableHttpResponse response2 = httpClient.execute(httpGet)) {
|
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
|
||||||
String responseString = EntityUtils.toString(response2.getEntity());
|
String responseString = EntityUtils.toString(response.getEntity());
|
||||||
Map<String, Object> responseMap = JSONUtil.toBean(responseString, Map.class);
|
Map<String, Object> responseMap = JSONUtil.toBean(responseString, Map.class);
|
||||||
//打印出返回前端的所有参数
|
//打印出返回前端的所有参数
|
||||||
// 获取键的集合
|
// 获取键的集合
|
||||||
|
Loading…
x
Reference in New Issue
Block a user