|
@@ -3,6 +3,8 @@ package com.travel.controller;
|
|
|
import com.alipay.api.CertAlipayRequest;
|
|
|
import com.alipay.api.internal.util.AlipaySignature;
|
|
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
|
|
+import com.alipay.api.request.AlipayTradePrecreateRequest;
|
|
|
+import com.alipay.api.response.AlipayTradePrecreateResponse;
|
|
|
import com.travel.model.BuyOfferNum;
|
|
|
import com.travel.model.Supplier;
|
|
|
import com.travel.model.SupplierRelease;
|
|
@@ -50,7 +52,7 @@ public class ZfbPayController extends ZfbPayUtils {
|
|
|
*/
|
|
|
@RequestMapping("/toPay")
|
|
|
@ResponseBody
|
|
|
- public String toPay(String price, String attach) throws Exception {
|
|
|
+ public Map<String, Object> toPay(String price, String attach) throws Exception {
|
|
|
//获得初始化的alipayConfig参数 //证书模式
|
|
|
CertAlipayRequest alipayConfig = new CertAlipayRequest();
|
|
|
alipayConfig.setPrivateKey(MERCHANTPRIVATEKEY);//应用秘钥
|
|
@@ -71,19 +73,25 @@ public class ZfbPayController extends ZfbPayUtils {
|
|
|
String content = "{\"out_trade_no\":\""+ out_trade_no +"\","
|
|
|
+ "\"total_amount\":\""+ price +"\"," + "\"subject\":\"途丫-"+ out_trade_no +"\","
|
|
|
+ "\"timeout_express\":\""+ timeout +"\","
|
|
|
- + "\"body\":\""+ attach +"\","
|
|
|
- + "\"qr_pay_mode\":\"2\","
|
|
|
- + "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}";
|
|
|
- AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
|
|
|
+ + "\"body\":\""+ attach +"\"}";
|
|
|
+ AlipayTradePrecreateRequest alipayRequest = new AlipayTradePrecreateRequest();
|
|
|
alipayRequest.setNotifyUrl(NOTIFYURL);
|
|
|
alipayRequest.setBizContent(content);
|
|
|
- //请求
|
|
|
- String result = "";
|
|
|
- //请求
|
|
|
- String head = "<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'></head><body>";
|
|
|
- result = alipayClient.pageExecute(alipayRequest).getBody();
|
|
|
- String bottom = "</body></html>";
|
|
|
- return head + result + bottom;
|
|
|
+ AlipayTradePrecreateResponse response = alipayClient.certificateExecute(alipayRequest);
|
|
|
+ //返回前端生成二维码
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+// ZFBPay wxPay = new ZFBPay()
|
|
|
+// .setUuid(snowflakeUtil.nextId() + "")
|
|
|
+// .setMchId(APPID)
|
|
|
+// .setReleaseUuid(attach)
|
|
|
+// .setCodeUrl(response.getQrCode())
|
|
|
+// .setOutTradeNo(out_trade_no)
|
|
|
+// .setTotalFee(price)
|
|
|
+// .setBody("途丫-" + out_trade_no);
|
|
|
+// zfbPayService.pay(wxPay);
|
|
|
+ resultMap.put("out_trade_no", out_trade_no);//订单编号
|
|
|
+ resultMap.put("code_url", response.getQrCode());//支付路径
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -282,7 +290,7 @@ public class ZfbPayController extends ZfbPayUtils {
|
|
|
supplierRelease2.setOrderType("2");
|
|
|
zfbPayService.updatePrivateType(supplierRelease2);
|
|
|
Map<String, Object> mapCommis = indexService.getSitesInfo();//查询系统配置
|
|
|
- String amount = AmountUtil.moneyMul(wxPay.getTotalFee(), (String) mapCommis.get("percentageFee"));//手续费
|
|
|
+ String amount = AmountUtil.moneyMul(wxPay.getTotalFee(), String.valueOf(mapCommis.get("percentage_fee")));//手续费
|
|
|
//实际金额 - 手续费 = 供应商收入
|
|
|
String poundage = AmountUtil.moneySub(wxPay.getTotalFee(), amount);
|
|
|
//用户购买报价单后将供应商收入存入供应商余额
|