From 55334da20cff4dac840c320eda1d0ca53ba27eda Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期一, 23 九月 2024 14:26:36 +0800 Subject: [PATCH] Merge branch 'master-stander' into master-xlk --- src/main/java/com/hx/corp/util/WxCorpPayUtil.java | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hx/corp/util/WxCorpPayUtil.java b/src/main/java/com/hx/corp/util/WxCorpPayUtil.java index 9f29441..7ddf66e 100644 --- a/src/main/java/com/hx/corp/util/WxCorpPayUtil.java +++ b/src/main/java/com/hx/corp/util/WxCorpPayUtil.java @@ -1,10 +1,12 @@ package com.hx.corp.util; import com.alibaba.fastjson.JSON; +import com.hx.util.corp.entity.AppLetInfo; import com.hx.corp.entity.CorpPayRequest; import com.hx.corp.entity.CorpPayResponse; import com.hx.exception.ServiceException; import com.hx.mp.util.*; +import com.hx.util.HttpMethodUtil; import com.hx.util.SimpleTool; import com.hx.util.StringUtils; import net.sf.json.JSONObject; @@ -71,20 +73,21 @@ parameters.put("nonce_str", corpPayRequest.getNonce_str()); parameters.put("openid", corpPayRequest.getOpenid()); parameters.put("check_name", corpPayRequest.getCheck_name()); - parameters.put("amount", corpPayRequest.getAmount()); + parameters.put("amount", corpPayRequest.getAmount().toString()); parameters.put("spbill_create_ip", corpPayRequest.getSpbill_create_ip()); parameters.put("desc", corpPayRequest.getDesc()); - String sign = WXSignUtils.createSign("UTF-8", parameters, mchKey); - - parameters.put("sign", sign); + corpPayRequest.setSign(WXSignUtils.createSign("UTF-8", parameters, mchKey)); + parameters.put("sign", corpPayRequest.getSign()); String xmlInfo = HttpXmlUtils.transferXml(parameters); - try { CloseableHttpResponse response = HttpUtil.Post(CORP_PAY_URL, xmlInfo, true, certPath, corpPayRequest.getMchid()); String transfersXml = EntityUtils.toString(response.getEntity(), "utf-8"); - // System.out.println("娓犻亾绔紒涓氫粯娆撅細" + transfersXml); - Map<String, String> transferMap = HttpXmlUtils.parseRefundXml(transfersXml); + + //Map<String, String> transferMap = HttpXmlUtils.parseRefundXml(transfersXml); + + Map<String,Object> transferMap = XMLUtil.doXMLParse(transfersXml); + // 灏� Map 杞崲涓� 瀹炰綋绫� corpPayResponse = JSON.parseObject(JSON.toJSONString(transferMap),CorpPayResponse.class); } catch (Exception e) { -- Gitblit v1.8.0