From e52227b01983146f2e3c81dc575141d8b9889497 Mon Sep 17 00:00:00 2001 From: yanghb <yanghb> Date: 星期五, 21 四月 2023 10:16:30 +0800 Subject: [PATCH] 代码调整 --- DriverTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/DriverTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java b/DriverTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java index 60916e2..5175e96 100644 --- a/DriverTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java +++ b/DriverTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java @@ -9,6 +9,7 @@ import com.icbc.api.request.*; import com.icbc.api.response.*; import com.icbc.api.utils.IcbcSignature; +import com.stylefeng.guns.modular.system.util.httpClinet.HttpClientUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -83,7 +84,7 @@ * @param type 支付端类型(1:用户端,2:司机端,3:小程序) * @throws UnknownHostException */ - public Map<String, String> placeAnOrder1(String out_trade_no, Integer pay_mode, Integer access_type, String deciveInfo, String body, Double total_fee, String mer_url, String attach, Integer type, String openId) throws Exception { + public Map<String, String> placeAnOrder(String out_trade_no, Integer pay_mode, Integer access_type, String deciveInfo, String body, Double total_fee, String mer_url, String attach, Integer type, String openId) throws Exception { //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值 DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey); CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1 request = new @@ -102,7 +103,7 @@ bizContent.setMer_prtcl_no(mer_prtcl_no); bizContent.setOrig_date_time(format); bizContent.setDecive_info(deciveInfo); - bizContent.setBody("嘉易行-" + body); + bizContent.setBody("OK出行-" + body); bizContent.setFee_type("001"); InetAddress ip4 = Inet4Address.getLocalHost(); bizContent.setSpbill_create_ip(ip4.getHostAddress()); @@ -206,7 +207,7 @@ * @param order_id 工行订单号 * @return */ - public String queryTransaction1(String out_trade_no, String order_id){ + public String queryTransaction(String out_trade_no, String order_id){ //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值 DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey); CardbusinessAggregatepayB2cOnlineOrderqryRequestV1 request = new CardbusinessAggregatepayB2cOnlineOrderqryRequestV1(); @@ -251,7 +252,7 @@ * @return * @throws Exception */ - public Map<String, String> payCallback1(HttpServletRequest request) throws Exception{ + public Map<String, String> payCallback(HttpServletRequest request) throws Exception{ String biz_content1 = request.getParameter("biz_content"); JSONObject biz_content = JSON.parseObject(biz_content1); int return_code = biz_content.getIntValue("return_code"); @@ -281,7 +282,7 @@ * @param response * @throws Exception */ - public void answer1(HttpServletResponse response) throws Exception{ + public void answer(HttpServletResponse response) throws Exception{ response.setContentType("application/json;charset=UTF-8"); StringBuffer sb = new StringBuffer(); String nativeUUID = UUIDUtil.getNativeUUID(); @@ -306,7 +307,7 @@ * @param payeeCnname 收款账户名称 * @return */ - public ResultUtil<String> transfer1(Long money, String payeeAccount, String payeeCnname) throws Exception{ + public ResultUtil<String> transfer(Long money, String payeeAccount, String payeeCnname) throws Exception{ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sdf_ = new SimpleDateFormat("HHmmssSSS"); Date date = new Date(); @@ -425,7 +426,7 @@ * @return * @throws Exception */ - public ResultUtil<Map<String, Object>> generate1(String out_trade_no, Double order_amt, Date orderTime, String attach, String notify_url) throws Exception{ + public ResultUtil<Map<String, Object>> generate(String out_trade_no, Double order_amt, Date orderTime, String attach, String notify_url) throws Exception{ order_amt = order_amt * 100; SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sdf1 = new SimpleDateFormat("HHmmss"); @@ -471,7 +472,7 @@ * @param order_id 工行订单号 * @return */ - public String queryGeneratePayState1(String out_trade_no, String order_id){ + public String queryGeneratePayState(String out_trade_no, String order_id){ //签名类型为RSA2时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA2,其他参数使用缺省值 DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey); QrcodeQueryRequestV2 request = new QrcodeQueryRequestV2(); @@ -512,7 +513,7 @@ * @return * @throws Exception */ - public Map<String, String> generatePayCallback1(HttpServletRequest request) throws Exception{ + public Map<String, String> generatePayCallback(HttpServletRequest request) throws Exception{ String biz_content1 = request.getParameter("biz_content"); JSONObject biz_content = JSON.parseObject(biz_content1); String return_code = biz_content.getString("return_code"); @@ -653,7 +654,12 @@ String url = "https://bankaddress.shumaidata.com/bankaddress?bankcard=" + code; Map<String, String> header = new HashMap<>(); header.put("Authorization", "APPCODE b7d32437d08149099457dcb50fb57df2"); - String get = httpClientUtil.pushHttpRequset("GET", url, null, header, "form"); + String get = null; + try { + get = httpClientUtil.pushHttpRequset("GET", url, null, header, "form").getData(); + } catch (Exception e) { + e.printStackTrace(); + } JSONObject jsonObject = JSON.parseObject(get); int code1 = jsonObject.getIntValue("code"); Map<String, String> map = new HashMap<>(); -- Gitblit v1.7.1