|
@@ -304,7 +304,7 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String payWechat(TOrder order) throws Exception {
|
|
|
+ public JSONObject payWechat(TOrder order, String openid) throws Exception {
|
|
|
String url = "https://api.huifu.com/v2/trade/payment/jspay";
|
|
|
HuifuBaseCommon.doInit(OppsMerchantConfig.getMerchantConfig());
|
|
|
JSONObject request = new JSONObject();
|
|
@@ -323,17 +323,19 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
|
|
|
String productName = order.getProductName();
|
|
|
TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
|
|
|
String client6 = clientId.substring(clientId.length() - 6);
|
|
|
- String productName1 = "";
|
|
|
+ String goodsDesc = "";
|
|
|
if (order.getProductNumber() > 1) {
|
|
|
if (equipment.getMachineType() == null || equipment.getMachineType().equals("0")) {
|
|
|
- productName1 = "棉花糖-" + equipment.getName() + "-" + client6;
|
|
|
- } else {
|
|
|
- productName1 = "爆米花-" + equipment.getName() + "-" + client6;
|
|
|
+ goodsDesc = "棉花糖-" + equipment.getName() + "-" + client6;
|
|
|
+ } else if (equipment.getMachineType().equals("1")) {
|
|
|
+ goodsDesc = "爆米花-" + equipment.getName() + "-" + client6;
|
|
|
+ } else if (equipment.getMachineType().equals("2")) {
|
|
|
+ goodsDesc = "雪糕-" + equipment.getName() + "-" + client6;
|
|
|
}
|
|
|
} else {
|
|
|
- productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ goodsDesc = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
}
|
|
|
- request.put("goods_desc", productName1);
|
|
|
+ request.put("goods_desc", goodsDesc);
|
|
|
request.put("notify_url", HuifuConstant.Notify_Url);
|
|
|
// 分账明细
|
|
|
request.put("acct_split_bunch", order.getAcctSplitBunch());
|
|
@@ -341,11 +343,10 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
|
|
|
JSONObject wxData = new JSONObject();
|
|
|
if (StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
wxData.put("sub_appid", HuifuConstant.SC_WX_SUB_APP_ID);
|
|
|
- wxData.put("open_id", HuifuConstant.SC_OPEN_ID);
|
|
|
} else {
|
|
|
wxData.put("sub_appid", HuifuConstant.SZ_WX_SUB_APP_ID);
|
|
|
- wxData.put("open_id", HuifuConstant.SZ_OPEN_ID);
|
|
|
}
|
|
|
+ wxData.put("open_id", openid);
|
|
|
request.put("wx_data", wxData);
|
|
|
// 签名:sign
|
|
|
String s = JSON.toJSONString(request);
|
|
@@ -357,32 +358,21 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
|
|
|
requestData.put("product_id", HuifuConstant.PRODUCT_ID);
|
|
|
requestData.put("sign", sign);
|
|
|
requestData.put("data", request);
|
|
|
- log.info("汇付微信扫码下单:" + requestData);
|
|
|
String success = OkHttpClientTools.httpPost(url, requestData.toString(), HuifuConstant.PRODUCT_ID);
|
|
|
// 拿到返回参数
|
|
|
JSONObject result = JSONObject.parseObject(success);
|
|
|
- log.info("汇付微信扫码下单返回参数:{}", result);
|
|
|
JSONObject data = result.getJSONObject("data");
|
|
|
- String payInfo = data.getString("pay_info");
|
|
|
- JSONObject payInfoJson = JSONObject.parseObject(payInfo);
|
|
|
- // 获取timeStamp的值
|
|
|
- String timeStamp = payInfoJson.getString("timeStamp");
|
|
|
- // 获取nonceStr的值
|
|
|
- String nonceStr = payInfoJson.getString("nonceStr");
|
|
|
- // 获取package的值
|
|
|
- String packageValue = payInfoJson.getString("package");
|
|
|
- // 获取paySign的值
|
|
|
- String paySign = payInfoJson.getString("paySign");
|
|
|
-
|
|
|
- // 保存支付参数
|
|
|
- WechatPayInfo wechatPayInfo = new WechatPayInfo();
|
|
|
- wechatPayInfo.setSn(sn);
|
|
|
- wechatPayInfo.setTimeStamp(timeStamp);
|
|
|
- wechatPayInfo.setNonceStr(nonceStr);
|
|
|
- wechatPayInfo.setPackageValue(packageValue);
|
|
|
- wechatPayInfo.setPaySign(paySign);
|
|
|
- wechatPayInfoService.save(wechatPayInfo);
|
|
|
+// String payInfo = data.getString("pay_info");
|
|
|
+// JSONObject payInfoJson = JSONObject.parseObject(payInfo);
|
|
|
+// // 获取timeStamp的值
|
|
|
+// String timeStamp = payInfoJson.getString("timeStamp");
|
|
|
+// // 获取nonceStr的值
|
|
|
+// String nonceStr = payInfoJson.getString("nonceStr");
|
|
|
+// // 获取package的值
|
|
|
+// String packageValue = payInfoJson.getString("package");
|
|
|
+// // 获取paySign的值
|
|
|
+// String paySign = payInfoJson.getString("paySign");
|
|
|
|
|
|
- return sn;
|
|
|
+ return data;
|
|
|
}
|
|
|
}
|