Pu Zhibing
2025-11-13 b9cc1011eb0ef761bfebea94cd684b1ee68f4e4a
DriverFBTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PayMoneyUtil.java
@@ -366,7 +366,7 @@
                        map2.put("nonceStr", map1.get("nonce_str"));
                        map2.put("package", "prepay_id=" + prepay_id);
                        map2.put("signType", "MD5");
                        map2.put("timeStamp", new Date().getTime() + "");
                        map2.put("timeStamp", System.currentTimeMillis() + "");
                        String s2 = this.weixinSignature(map2);
                        map2.put("prepay_id", prepay_id);
@@ -388,7 +388,7 @@
                        map3.put("package", "Sign=WXPay");
                        map3.put("partnerid", mchId);
                        map3.put("prepayid", prepay_id);
                        map3.put("timestamp", new Date().getTime() / 1000);
                        map3.put("timestamp", System.currentTimeMillis() / 1000);
                        String s1 = this.weixinSignature(map3);
                        map3.put("sign", s1);
                        System.err.println(map3);
@@ -526,7 +526,7 @@
                        map2.put("package", "Sign=WXPay");
                        map2.put("partnerid", mchId);
                        map2.put("prepayid", prepay_id);
                        map2.put("timestamp", new Date().getTime() + "");
                        map2.put("timestamp", System.currentTimeMillis() + "");
                        String s1 = this.weixinSignature(map2);
                        map2.put("pac", "Sign=WXPay");
@@ -721,13 +721,14 @@
     * @return
     * @throws Exception
     */
    public ResultUtil queryWXOrder() throws Exception{
    public ResultUtil<Map<String, String>> queryWXOrder(String out_trade_no, String transaction_id) throws Exception{
        String url = "https://api.mch.weixin.qq.com/pay/orderquery";
        String nonce_str = UUIDUtil.getRandomCode(16);
        Map<String, Object> map = new HashMap<>();
        map.put("appid", appid);
        map.put("mch_id", mchId);
        map.put("transaction_id", nonce_str);//微信订单号
        map.put("out_trade_no", out_trade_no);//商户订单号
        map.put("transaction_id", transaction_id);//微信订单号
        map.put("nonce_str", nonce_str);//随机字符串
        String s = this.weixinSignature(map);
        map.put("sign", s);
@@ -762,29 +763,18 @@
        if("SUCCESS".equals(return_code)){
            String result_code = map1.get("result_code");
            if("SUCCESS".equals(result_code)){
                String type = map1.get("trade_type");
                switch (type){
                    case "JSAPI":
                        break;
                    case "NATIVE":
                        String code_url = map1.get("code_url");
                        return ResultUtil.success(code_url);
                    case "APP":
                        String trade_state = map1.get("trade_state");
                        String time_end = map1.get("time_end");
                        Map<String, Object> map2 = new HashMap<>();
                        map2.put("trade_state", trade_state);//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败)
                        map2.put("time_end", time_end);//订单支付时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。
                Map<String, String> map2 = new HashMap<>();
                map2.put("trade_type", map1.get("trade_type"));
                map2.put("trade_state", map1.get("trade_state"));//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败)
                map2.put("transaction_id", map1.get("transaction_id"));
                        return ResultUtil.success(map2);
                }
                return null;
            }else{
                System.err.println(map1.get("err_code_des"));
                return ResultUtil.error(map1.get("err_code_des"));
            }
        }else{
            System.err.println(map1.get("return_msg") + appid + "----" + mchId);
            return ResultUtil.error(map1.get("return_msg"), new JSONObject());
            return ResultUtil.error(map1.get("return_msg"));
        }
    }