1
0
Преглед на файлове

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 преди 6 години
родител
ревизия
c6eddd77ff

+ 3 - 3
kmall-api/src/main/java/com/kmall/api/api/ApiPayController.java

@@ -15,7 +15,7 @@ import com.kmall.common.utils.MapUtils;
 import com.kmall.common.utils.XmlUtil;
 import com.kmall.common.utils.wechat.AESUtil;
 import com.kmall.common.utils.wechat.WechatRefundApiResult;
-import com.kmall.common.utils.wechat.WechatRefundResult;
+import com.kmall.common.utils.wechat.WechatRefundNotifyResult;
 import com.kmall.common.utils.wechat.WechatUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -225,7 +225,7 @@ public class ApiPayController extends ApiBaseAction {
     @RequestMapping(value = "/notify", produces = "text/html;charset=UTF-8")
     @ResponseBody
     public void notify(HttpServletRequest request, HttpServletResponse response) {
-        logger.error("notify start");
+        logger.info("微信订单回调接口>>>>>>notify start");
         try {
             request.setCharacterEncoding("UTF-8");
             response.setCharacterEncoding("UTF-8");
@@ -345,7 +345,7 @@ public class ApiPayController extends ApiBaseAction {
             in.close();
             String reponseXml = new String(out.toByteArray(), "utf-8");//xml数据
             logger.error("reponseXml:" + reponseXml);
-            WechatRefundResult result = (WechatRefundResult) XmlUtil.xmlStrToBean(reponseXml, WechatRefundResult.class);
+            WechatRefundNotifyResult result = (WechatRefundNotifyResult) XmlUtil.xmlStrToBean(reponseXml, WechatRefundNotifyResult.class);
 
             if (result.getReturn_code().equalsIgnoreCase("FAIL")) {
                 logger.info("微信查询接口调用失败: "+result.getReturn_msg());

+ 1 - 0
kmall-common/src/main/java/com/kmall/common/utils/DateUtils.java

@@ -23,6 +23,7 @@ public class DateUtils {
      * 时间格式(yyyy-MM-dd)
      */
     public final static String DATE_PATTERN = "yyyy-MM-dd";
+    public static String DATE_TIME_PATTERN_YYYY_MM_DD = "yyyyMMdd";
     /**
      * 无分隔符日期格式 "yyyyMMddHHmmss"
      */

+ 4 - 10
kmall-common/src/main/java/com/kmall/common/utils/wechat/WechatUtil.java

@@ -175,7 +175,6 @@ public class WechatUtil {
      * 请求微信https
      **/
     private static String sendSSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf, String requestUrl) {
-
         HttpPost httPost = new HttpPost(requestUrl);
         httPost.addHeader("Connection", "keep-alive");
         httPost.addHeader("Accept", "*/*");
@@ -280,7 +279,6 @@ public class WechatUtil {
      * 方法描述:根据签名加密请求参数
      * 创建时间:2017年6月8日  上午11:28:52
      * 作者: xubo
-     *
      * @param
      * @return
      */
@@ -571,20 +569,18 @@ public class WechatUtil {
         params.put("sign", arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
         return params;
     }
-
-
     /**
-     * 绑定撤销订单输入参数
+     * 撤销订单输入参数
      *
      * @param out_trade_no 订单编号(发送到微信的编号)
-     * @return 撤销订单输入参数
+     * @return 撤销订单输入参数
      */
     private static Map<Object, Object> buildReverseRequsetMapParam(String out_trade_no) {
         Map<Object, Object> params = new HashMap<Object, Object>();
         params.put("appid", CommonWxPayPropertiesBuilder.instance().getAppId());//微信分配的公众账号ID(企业号corpid即为此appId)
         params.put("mch_id", CommonWxPayPropertiesBuilder.instance().getMchId());//微信支付分配的商户号
-        params.put("out_trade_no", out_trade_no);//商户传给微信的订单号
         params.put("nonce_str", CharUtil.getRandomString(16));//随机字符串,不长于32位。推荐随机数生成算法
+        params.put("out_trade_no", out_trade_no);//商户传给微信的订单号
         //签名前必须要参数全部写在前面
         params.put("sign", arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
         return params;
@@ -609,7 +605,7 @@ public class WechatUtil {
     }
 
     /**
-     * 请求退款微信
+     * 线下扫码支付请求微信退款
      **/
     private static String sendMicropaySSLPostToWx(String mapToXml) {
         logger.info("*******付款码支付(WX Request:" + mapToXml);
@@ -628,7 +624,6 @@ public class WechatUtil {
         return xmlStr;
     }
 
-
     /**
      * 请求查询订单微信
      **/
@@ -639,7 +634,6 @@ public class WechatUtil {
         return xmlStr;
     }
 
-
     public static void main(String[] args) throws Exception {
         Map<Object, Object> parame = new TreeMap<Object, Object>();
         parame.put("mch_id", ResourceUtil.getConfigByName("\\conf\\wx-mp", "wx.mchId"));//

+ 292 - 0
kmall-common/src/main/java/com/kmall/common/utils/wechat/wxglobal/WechatGlobalUtil.java

@@ -0,0 +1,292 @@
+package com.kmall.common.utils.wechat.wxglobal;
+
+import com.alibaba.druid.support.logging.Log;
+import com.alibaba.druid.support.logging.LogFactory;
+import com.kmall.common.service.pay.wxpay.CommonWxPayPropertiesBuilder;
+import com.kmall.common.utils.*;
+import com.kmall.common.utils.wechat.*;
+import com.kmall.common.utils.wechat.wxglobal.dto.WechatGlobalQueryApiResult;
+import com.kmall.common.utils.wechat.wxglobal.dto.WechatGlobalQueryRateResult;
+import com.kmall.common.utils.wechat.wxglobal.dto.WechatGlobalRefundApiResult;
+import com.kmall.common.utils.wechat.wxglobal.dto.WechatGlobalRefundQueryResult;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.net.URLEncoder;
+import java.util.*;
+
+/**
+ * <p>Title: 微信退款工具类</p>
+ * <p>Description: 微信退款工具类,通过充值客户端的不同初始化不同的工具类,得到相应微信退款相关的appid和muchid</p>
+ *
+ * @author xubo
+ * @date 2017年6月6日  下午5:05:03
+ */
+public class WechatGlobalUtil {
+    private static Log logger = LogFactory.getLog(WechatGlobalUtil.class);
+    private static final String EMPTY = "";
+    private static final String URL_PARAM_CONNECT_FLAG = "&";
+
+    /**
+     * 菜单类型
+     *
+     * @author Scott
+     * @email
+     * @date 2016年11月15日 下午1:24:29
+     */
+    public enum WXTradeState {
+        /**
+         * 支付成功
+         */
+        SUCCESS("SUCCESS", "支付成功"),
+        /**
+         * 转入退款
+         */
+        REFUND("REFUND", "转入退款"),
+
+        /**
+         * 未支付
+         */
+        NOTPAY("NOTPAY", "未支付"),
+
+        /**
+         * 已关闭
+         */
+        CLOSED("CLOSED", "已关闭"),
+
+        /**
+         * 已撤销(付款码支付)
+         */
+        REVOKED("REVOKED", "已撤销"),
+
+        /**
+         * 用户支付中(付款码支付)
+         */
+        USERPAYING("USERPAYING", "用户支付中"),
+
+        /**
+         * 支付失败(付款码支付)
+         */
+        PAYERROR("PAYERROR", "支付失败");
+
+        private String code;
+        private String codeZn;
+
+        private WXTradeState(String code, String codeZn) {
+            this.code = code;
+            this.codeZn = codeZn;
+        }
+
+        public String getCode() {
+            return code;
+        }
+
+        public String getCodeZn() {
+            return codeZn;
+        }
+    }
+
+
+    /**
+     * 微信境外查询订单
+     * @param
+     * @return
+     */
+    public static WechatGlobalQueryApiResult wxOrderQuery(String out_trade_no) {
+        //初始化请求微信服务器的配置信息包括appid密钥等
+        //构建请求参数
+        Map<Object, Object> params = new HashMap<Object, Object>();
+        params.put("appid", CommonWxPayPropertiesBuilder.instance().getAppId());//微信分配的公众账号ID(企业号corpid即为此appId)
+        params.put("mch_id", CommonWxPayPropertiesBuilder.instance().getMchId());//微信支付分配的商户号
+        params.put("out_trade_no", out_trade_no);//商户传给微信的订单号
+        params.put("nonce_str", CharUtil.getRandomString(16));//随机字符串,不长于32位。推荐随机数生成算法
+        //签名前必须要参数全部写在前面
+        params.put("sign", WechatUtil.arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
+        String mapToXml = MapUtils.convertMap2Xml(params);
+        //请求微信
+        String reponseXml = sendQuerySSLPostToWx(mapToXml, WechatConfig.getSslcsf());
+        WechatGlobalQueryApiResult result =
+                (WechatGlobalQueryApiResult) XmlUtil.xmlStrToBean(reponseXml, WechatGlobalQueryApiResult.class);
+        return result;
+    }
+    /**
+     * 请求查询订单微信
+     **/
+    private static String sendQuerySSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf) {
+        logger.info("*******查询订单(WX Request:" + mapToXml);
+        String xmlStr = sendSSLPostToWx(mapToXml, sslcsf, CommonWxPayPropertiesBuilder.instance().getOrderquery());
+        logger.info("*******查询订单(WX Response:" + xmlStr);
+        return xmlStr;
+    }
+
+    /**
+     * 微信查询汇率
+     * @param out_trade_no
+     * @return
+     */
+    public static WechatGlobalQueryRateResult wxQueryexchagerate(String out_trade_no) {
+        //初始化请求微信服务器的配置信息包括appid密钥等
+        //构建请求参数
+        Map<Object, Object> params = new HashMap<Object, Object>();
+        params.put("appid", CommonWxPayPropertiesBuilder.instance().getAppId());//微信分配的公众账号ID(企业号corpid即为此appId)
+        params.put("mch_id", CommonWxPayPropertiesBuilder.instance().getMchId());//微信支付分配的商户号
+        params.put("fee_type", "HKD");//外币币种
+        params.put("date", DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD));//格式为yyyyMMdd
+        //签名前必须要参数全部写在前面
+        params.put("sign", WechatUtil.arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
+        String mapToXml = MapUtils.convertMap2Xml(params);
+        //请求微信
+        String reponseXml = sendSSLPostToWx(mapToXml, WechatConfig.getSslcsf(), "https://api.mch.weixin.qq.com/pay/queryexchagerate");
+
+        WechatGlobalQueryRateResult result =
+                (WechatGlobalQueryRateResult) XmlUtil.xmlStrToBean(reponseXml, WechatGlobalQueryRateResult.class);
+        return result;
+    }
+
+    /**
+     * 微信境外申请退款
+     * @param
+     * @return
+     */
+    public static WechatGlobalRefundApiResult wxRefund(String out_trade_no, Double orderMoney, Double refundMoney) {
+        //初始化请求微信服务器的配置信息包括appid密钥等
+        //转换金钱格式
+        BigDecimal bdOrderMoney = new BigDecimal(orderMoney, MathContext.DECIMAL32);
+        BigDecimal bdRefundMoney = new BigDecimal(refundMoney, MathContext.DECIMAL32);
+        //构建请求参数
+        Map<Object, Object> params = new HashMap<Object, Object>();
+        params.put("appid", CommonWxPayPropertiesBuilder.instance().getAppId());//微信分配的公众账号ID(企业号corpid即为此appId)
+        params.put("mch_id", CommonWxPayPropertiesBuilder.instance().getMchId());//微信支付分配的商户号
+        params.put("nonce_str", CharUtil.getRandomString(16));//随机字符串,不长于32位。推荐随机数生成算法
+        params.put("out_trade_no", out_trade_no);//商户传给微信的订单号
+        params.put("out_refund_no", System.currentTimeMillis() + "");//商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
+        params.put("total_fee", bdOrderMoney.multiply(Constant.ONE_HUNDRED).intValue());//订单总金额,单位为分,只能为整数
+        params.put("refund_fee", bdRefundMoney.multiply(Constant.ONE_HUNDRED).intValue());//退款总金额,订单总金额,单位为分,只能为整数
+        params.put("op_user_id", CommonWxPayPropertiesBuilder.instance().getMchId());//操作员帐号, 默认为商户号
+        params.put("notify_url", CommonWxPayPropertiesBuilder.instance().getRefundNotifyUrl());
+        //签名前必须要参数全部写在前面
+        params.put("sign", WechatUtil.arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
+        String mapToXml = MapUtils.convertMap2Xml(params);
+
+        //请求微信
+        String reponseXml = sendRefundSSLPostToWx(mapToXml, WechatConfig.getSslcsf());
+        WechatGlobalRefundApiResult result =
+                (WechatGlobalRefundApiResult) XmlUtil.xmlStrToBean(reponseXml, WechatGlobalRefundApiResult.class);
+        result.setOut_refund_no((String) params.get("out_refund_no"));
+        return result;
+    }
+
+    /**
+     * 请求退款微信
+     **/
+    public static String sendRefundSSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf) {
+        logger.info("*******退款(WX Request:" + mapToXml);
+        String xmlStr = sendSSLPostToWx(mapToXml, sslcsf, CommonWxPayPropertiesBuilder.instance().getRefundUrl());
+        logger.info("*******退款(WX Response:" + xmlStr);
+        return xmlStr;
+    }
+
+
+    /**
+     * 微信境外查询退款
+     * @param
+     * @return
+     */
+    public static WechatGlobalRefundQueryResult wxRefundquery(String out_trade_no) {
+        Map<Object, Object> params = new HashMap<Object, Object>();
+        params.put("appid", CommonWxPayPropertiesBuilder.instance().getAppId());//微信分配的公众账号ID(企业号corpid即为此appId)
+        params.put("mch_id", CommonWxPayPropertiesBuilder.instance().getMchId());//微信支付分配的商户号
+        params.put("nonce_str", CharUtil.getRandomString(16));//随机字符串,不长于32位。推荐随机数生成算法
+        params.put("out_trade_no", out_trade_no);//商户侧传给微信的订单号
+        //签名前必须要参数全部写在前面
+        params.put("sign", WechatUtil.arraySign(params, CommonWxPayPropertiesBuilder.instance().getPaySignKey()));//签名
+        String mapToXml = MapUtils.convertMap2Xml(params);
+        String reponseXml = sendRefundQerutySSLPostToWx(mapToXml, WechatConfig.getSslcsf());
+        System.out.println(reponseXml);
+        WechatGlobalRefundQueryResult result =
+                (WechatGlobalRefundQueryResult) XmlUtil.xmlStrToBean(reponseXml, WechatGlobalRefundQueryResult.class);
+        result.setXmlStr(reponseXml);
+        return result;
+    }
+    public static String sendRefundQerutySSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf) {
+        logger.info("*******退款查询(WX Request:" + mapToXml);
+        String xmlStr = sendSSLPostToWx(mapToXml, sslcsf, CommonWxPayPropertiesBuilder.instance().getRefundqueryUrl());
+        logger.info("*******退款查询(WX Response:" + xmlStr);
+        return xmlStr;
+    }
+
+    /**
+     * 请求微信https
+     **/
+    private static String sendSSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf, String requestUrl) {
+
+        HttpPost httPost = new HttpPost(requestUrl);
+        httPost.addHeader("Connection", "keep-alive");
+        httPost.addHeader("Accept", "*/*");
+        httPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+        httPost.addHeader("Host", "api.mch.weixin.qq.com");
+        httPost.addHeader("X-Requested-With", "XMLHttpRequest");
+        httPost.addHeader("Cache-Control", "max-age=0");
+        httPost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
+        httPost.setEntity(new StringEntity(mapToXml, "UTF-8"));
+        CloseableHttpClient httpClient = null;
+        if (sslcsf != null) {
+            httpClient = HttpClients.custom().setSSLSocketFactory(sslcsf).build();
+        } else {
+            httpClient = HttpClients.createDefault();
+        }
+
+        CloseableHttpResponse response = null;
+        try {
+            response = httpClient.execute(httPost);
+            HttpEntity entity = response.getEntity();
+            String xmlStr = EntityUtils.toString(entity, "UTF-8");
+            return xmlStr;
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+            } catch (IOException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Map<Object, Object> parame = new TreeMap<Object, Object>();
+        parame.put("mch_id", "");//
+        String randomStr = CharUtil.getRandomNum(18).toUpperCase();
+        parame.put("nonce_str", randomStr);//
+        String sign = WechatUtil.arraySign(parame, "");
+        parame.put("sign", sign);// 数字签证
+
+        String xml = MapUtils.convertMap2Xml(parame);
+        logger.info("xml:" + xml);
+        Map<String, Object> resultUn = XmlUtil.xmlStrToMap(
+                WechatUtil.requestOnce("https://apitest.mch.weixin.qq.com/sandboxnew/pay/getsignkey", xml));
+        System.out.print(resultUn);
+    }
+}

+ 240 - 0
kmall-common/src/main/java/com/kmall/common/utils/wechat/wxglobal/dto/WechatGlobalQueryApiResult.java

@@ -0,0 +1,240 @@
+package com.kmall.common.utils.wechat.wxglobal.dto;
+
+/**
+ * 微信境外支付查询返回的字段
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-12-11 10:22
+ */
+public class WechatGlobalQueryApiResult {
+	private String return_code;
+	private String return_msg;
+
+	private String appid;
+	private String mch_id;
+	private String nonce_str;
+	private String sign;
+	private String result_code;
+	private String err_code;
+	private String err_code_des;
+
+	private String device_info;
+	private String openId;//用户标识
+	private String is_subscribe;//是否关注公众账号
+	private String trade_type;//调用接口提交的交易类型,取值如下:JSAPI,NATIVE,APP,MICROPAY
+	/**
+	 * SUCCESS—支付成功
+	 REFUND—转入退款
+	 NOTPAY—未支付
+	 CLOSED—已关闭
+	 REVOKED—已撤销(刷卡支付)
+	 USERPAYING--用户支付中
+	 PAYERROR--支付失败(其他原因,如银行返回失败)
+	 */
+	private String trade_state;
+	private String bank_type;//付款银行
+	private String total_fee;//订单金额
+	private String fee_type;
+	private String cash_fee;//用户支付金额
+	private String cash_fee_type;//用户支付金额币种
+	private String transaction_id;
+	private String out_trade_no;
+	private String attach;//附加数据
+	private String time_end;//支付完成时间 yyyyMMddHHmmss
+	/**
+	 * 标价币种与支付币种的兑换比例乘以10的8次方即为此值,例如美元兑换人民币的比例为6.5,则rate=650000000
+	 */
+	private String rate;//汇率
+
+	public String getReturn_code() {
+		return return_code;
+	}
+
+	public void setReturn_code(String return_code) {
+		this.return_code = return_code;
+	}
+
+	public String getReturn_msg() {
+		return return_msg;
+	}
+
+	public void setReturn_msg(String return_msg) {
+		this.return_msg = return_msg;
+	}
+
+	public String getAppid() {
+		return appid;
+	}
+
+	public void setAppid(String appid) {
+		this.appid = appid;
+	}
+
+	public String getMch_id() {
+		return mch_id;
+	}
+
+	public void setMch_id(String mch_id) {
+		this.mch_id = mch_id;
+	}
+
+	public String getNonce_str() {
+		return nonce_str;
+	}
+
+	public void setNonce_str(String nonce_str) {
+		this.nonce_str = nonce_str;
+	}
+
+	public String getSign() {
+		return sign;
+	}
+
+	public void setSign(String sign) {
+		this.sign = sign;
+	}
+
+	public String getResult_code() {
+		return result_code;
+	}
+
+	public void setResult_code(String result_code) {
+		this.result_code = result_code;
+	}
+
+	public String getErr_code() {
+		return err_code;
+	}
+
+	public void setErr_code(String err_code) {
+		this.err_code = err_code;
+	}
+
+	public String getErr_code_des() {
+		return err_code_des;
+	}
+
+	public void setErr_code_des(String err_code_des) {
+		this.err_code_des = err_code_des;
+	}
+
+	public String getDevice_info() {
+		return device_info;
+	}
+
+	public void setDevice_info(String device_info) {
+		this.device_info = device_info;
+	}
+
+	public String getOpenId() {
+		return openId;
+	}
+
+	public void setOpenId(String openId) {
+		this.openId = openId;
+	}
+
+	public String getIs_subscribe() {
+		return is_subscribe;
+	}
+
+	public void setIs_subscribe(String is_subscribe) {
+		this.is_subscribe = is_subscribe;
+	}
+
+	public String getTrade_type() {
+		return trade_type;
+	}
+
+	public void setTrade_type(String trade_type) {
+		this.trade_type = trade_type;
+	}
+
+	public String getTrade_state() {
+		return trade_state;
+	}
+
+	public void setTrade_state(String trade_state) {
+		this.trade_state = trade_state;
+	}
+
+	public String getBank_type() {
+		return bank_type;
+	}
+
+	public void setBank_type(String bank_type) {
+		this.bank_type = bank_type;
+	}
+
+	public String getTotal_fee() {
+		return total_fee;
+	}
+
+	public void setTotal_fee(String total_fee) {
+		this.total_fee = total_fee;
+	}
+
+	public String getFee_type() {
+		return fee_type;
+	}
+
+	public void setFee_type(String fee_type) {
+		this.fee_type = fee_type;
+	}
+
+	public String getCash_fee() {
+		return cash_fee;
+	}
+
+	public void setCash_fee(String cash_fee) {
+		this.cash_fee = cash_fee;
+	}
+
+	public String getCash_fee_type() {
+		return cash_fee_type;
+	}
+
+	public void setCash_fee_type(String cash_fee_type) {
+		this.cash_fee_type = cash_fee_type;
+	}
+
+	public String getTransaction_id() {
+		return transaction_id;
+	}
+
+	public void setTransaction_id(String transaction_id) {
+		this.transaction_id = transaction_id;
+	}
+
+	public String getOut_trade_no() {
+		return out_trade_no;
+	}
+
+	public void setOut_trade_no(String out_trade_no) {
+		this.out_trade_no = out_trade_no;
+	}
+
+	public String getAttach() {
+		return attach;
+	}
+
+	public void setAttach(String attach) {
+		this.attach = attach;
+	}
+
+	public String getTime_end() {
+		return time_end;
+	}
+
+	public void setTime_end(String time_end) {
+		this.time_end = time_end;
+	}
+
+	public String getRate() {
+		return rate;
+	}
+
+	public void setRate(String rate) {
+		this.rate = rate;
+	}
+}

+ 199 - 0
kmall-common/src/main/java/com/kmall/common/utils/wechat/wxglobal/dto/WechatGlobalRefundApiResult.java

@@ -0,0 +1,199 @@
+package com.kmall.common.utils.wechat.wxglobal.dto;
+/**
+ * 微信境外申请退款返回的字段
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-12-11 10:22
+ */
+public class WechatGlobalRefundApiResult {
+	private String return_code;
+	private String return_msg;
+	
+	private String result_code;
+	private String err_code;
+	private String err_code_des;
+	private String appid;
+	private String mch_id;
+	private String nonce_str;
+	private String sign;
+	private String transaction_id;
+	private String out_trade_no;
+	private String out_refund_no;
+	private String refund_id;
+	private String refund_fee;//申请退款金额
+	private String refund_fee_type;//退款币种
+	private String total_fee;//订单金额
+	private String fee_type;
+	private String cash_fee;//用户支付金额
+	private String cash_fee_type;//用户支付金额币种
+	private String cash_refund_fee;//用户退款金额
+	private String cash_refund_fee_type;//用户退款金额币种
+
+	public String getReturn_code() {
+		return return_code;
+	}
+
+	public void setReturn_code(String return_code) {
+		this.return_code = return_code;
+	}
+
+	public String getReturn_msg() {
+		return return_msg;
+	}
+
+	public void setReturn_msg(String return_msg) {
+		this.return_msg = return_msg;
+	}
+
+	public String getResult_code() {
+		return result_code;
+	}
+
+	public void setResult_code(String result_code) {
+		this.result_code = result_code;
+	}
+
+	public String getErr_code() {
+		return err_code;
+	}
+
+	public void setErr_code(String err_code) {
+		this.err_code = err_code;
+	}
+
+	public String getErr_code_des() {
+		return err_code_des;
+	}
+
+	public void setErr_code_des(String err_code_des) {
+		this.err_code_des = err_code_des;
+	}
+
+	public String getAppid() {
+		return appid;
+	}
+
+	public void setAppid(String appid) {
+		this.appid = appid;
+	}
+
+	public String getMch_id() {
+		return mch_id;
+	}
+
+	public void setMch_id(String mch_id) {
+		this.mch_id = mch_id;
+	}
+
+	public String getNonce_str() {
+		return nonce_str;
+	}
+
+	public void setNonce_str(String nonce_str) {
+		this.nonce_str = nonce_str;
+	}
+
+	public String getSign() {
+		return sign;
+	}
+
+	public void setSign(String sign) {
+		this.sign = sign;
+	}
+
+	public String getTransaction_id() {
+		return transaction_id;
+	}
+
+	public void setTransaction_id(String transaction_id) {
+		this.transaction_id = transaction_id;
+	}
+
+	public String getOut_trade_no() {
+		return out_trade_no;
+	}
+
+	public void setOut_trade_no(String out_trade_no) {
+		this.out_trade_no = out_trade_no;
+	}
+
+	public String getOut_refund_no() {
+		return out_refund_no;
+	}
+
+	public void setOut_refund_no(String out_refund_no) {
+		this.out_refund_no = out_refund_no;
+	}
+
+	public String getRefund_id() {
+		return refund_id;
+	}
+
+	public void setRefund_id(String refund_id) {
+		this.refund_id = refund_id;
+	}
+
+	public String getRefund_fee() {
+		return refund_fee;
+	}
+
+	public void setRefund_fee(String refund_fee) {
+		this.refund_fee = refund_fee;
+	}
+
+	public String getRefund_fee_type() {
+		return refund_fee_type;
+	}
+
+	public void setRefund_fee_type(String refund_fee_type) {
+		this.refund_fee_type = refund_fee_type;
+	}
+
+	public String getTotal_fee() {
+		return total_fee;
+	}
+
+	public void setTotal_fee(String total_fee) {
+		this.total_fee = total_fee;
+	}
+
+	public String getFee_type() {
+		return fee_type;
+	}
+
+	public void setFee_type(String fee_type) {
+		this.fee_type = fee_type;
+	}
+
+	public String getCash_fee() {
+		return cash_fee;
+	}
+
+	public void setCash_fee(String cash_fee) {
+		this.cash_fee = cash_fee;
+	}
+
+	public String getCash_fee_type() {
+		return cash_fee_type;
+	}
+
+	public void setCash_fee_type(String cash_fee_type) {
+		this.cash_fee_type = cash_fee_type;
+	}
+
+	public String getCash_refund_fee() {
+		return cash_refund_fee;
+	}
+
+	public void setCash_refund_fee(String cash_refund_fee) {
+		this.cash_refund_fee = cash_refund_fee;
+	}
+
+	public String getCash_refund_fee_type() {
+		return cash_refund_fee_type;
+	}
+
+	public void setCash_refund_fee_type(String cash_refund_fee_type) {
+		this.cash_refund_fee_type = cash_refund_fee_type;
+	}
+}

+ 281 - 0
kmall-common/src/main/java/com/kmall/common/utils/wechat/wxglobal/dto/WechatGlobalRefundQueryResult.java

@@ -0,0 +1,281 @@
+package com.kmall.common.utils.wechat.wxglobal.dto;
+
+/**
+ * 微信境外退款查询返回的字段
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-12-11 10:22
+ */
+public class WechatGlobalRefundQueryResult {
+    private String xmlStr;
+    private String return_code;
+    private String return_msg;
+
+    private String result_code;
+    private String err_code;
+    private String err_code_des;
+    private String appid;
+    private String mch_id;
+    private String nonce_str;
+    private String sign;
+    private String transaction_id;//微信订单号
+    private String out_trade_no;//商户订单号
+    private String total_fee;//订单金额 订单总金额,单位为分,只能为整数
+//    private String settlement_total_fee;//应结订单金额 =订单金额-免充值优惠券金额
+    private String fee_type;//货币种类
+    private String cash_fee;//现金支付金额	现金支付金额,单位为分,只能为整数
+    private String cash_fee_type;//用户支付金额币种
+    private String rate;//汇率
+    private String total_refund_count;//订单总退款次数
+    private String refund_count;//退款笔数
+
+    /**
+     * 以下数据会有多条
+     */
+    private String refund_fee;//申请退款金额	 退款总金额,单位为分,可以做部分退款
+    private String out_refund_no;//商户退款单号
+    private String refund_id;//微信退款单号
+    private String refund_channel;//退款渠道 ORIGINAL—原路退款 BALANCE—退回到余额 OTHER_BALANCE—原账户异常退到其他余额账户 OTHER_BANKCARD—原银行卡异常退到其他银行卡
+    /**
+     * SUCCESS—退款成功
+     REFUNDCLOSE—退款关闭。
+     PROCESSING—退款处理中
+     CHANGE—退款异常,退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败
+     */
+    private String refund_status;//退款状态
+    /**
+     * REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款/基本账户
+     REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款
+     */
+    private String refund_account;//退款资金来源
+    /**
+     * 取当前退款单的退款入账方
+     1)退回银行卡:
+     {银行名称}{卡类型}{卡尾号}
+     2)退回支付用户零钱:
+     支付用户零钱
+     3)退还商户:
+     商户基本账户
+     商户结算银行账户
+     4)退回支付用户零钱通:
+     支付用户零钱通
+     */
+    private String refund_recv_accout;
+    private String refund_success_time;//退款成功时间
+
+    public String getXmlStr() {
+        return xmlStr;
+    }
+
+    public void setXmlStr(String xmlStr) {
+        this.xmlStr = xmlStr;
+    }
+
+    public String getReturn_code() {
+        return return_code;
+    }
+
+    public void setReturn_code(String return_code) {
+        this.return_code = return_code;
+    }
+
+    public String getReturn_msg() {
+        return return_msg;
+    }
+
+    public void setReturn_msg(String return_msg) {
+        this.return_msg = return_msg;
+    }
+
+    public String getResult_code() {
+        return result_code;
+    }
+
+    public void setResult_code(String result_code) {
+        this.result_code = result_code;
+    }
+
+    public String getErr_code() {
+        return err_code;
+    }
+
+    public void setErr_code(String err_code) {
+        this.err_code = err_code;
+    }
+
+    public String getErr_code_des() {
+        return err_code_des;
+    }
+
+    public void setErr_code_des(String err_code_des) {
+        this.err_code_des = err_code_des;
+    }
+
+    public String getAppid() {
+        return appid;
+    }
+
+    public void setAppid(String appid) {
+        this.appid = appid;
+    }
+
+    public String getMch_id() {
+        return mch_id;
+    }
+
+    public void setMch_id(String mch_id) {
+        this.mch_id = mch_id;
+    }
+
+    public String getNonce_str() {
+        return nonce_str;
+    }
+
+    public void setNonce_str(String nonce_str) {
+        this.nonce_str = nonce_str;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public String getTransaction_id() {
+        return transaction_id;
+    }
+
+    public void setTransaction_id(String transaction_id) {
+        this.transaction_id = transaction_id;
+    }
+
+    public String getOut_trade_no() {
+        return out_trade_no;
+    }
+
+    public void setOut_trade_no(String out_trade_no) {
+        this.out_trade_no = out_trade_no;
+    }
+
+    public String getTotal_fee() {
+        return total_fee;
+    }
+
+    public void setTotal_fee(String total_fee) {
+        this.total_fee = total_fee;
+    }
+
+    public String getFee_type() {
+        return fee_type;
+    }
+
+    public void setFee_type(String fee_type) {
+        this.fee_type = fee_type;
+    }
+
+    public String getCash_fee() {
+        return cash_fee;
+    }
+
+    public void setCash_fee(String cash_fee) {
+        this.cash_fee = cash_fee;
+    }
+
+    public String getCash_fee_type() {
+        return cash_fee_type;
+    }
+
+    public void setCash_fee_type(String cash_fee_type) {
+        this.cash_fee_type = cash_fee_type;
+    }
+
+    public String getRate() {
+        return rate;
+    }
+
+    public void setRate(String rate) {
+        this.rate = rate;
+    }
+
+    public String getTotal_refund_count() {
+        return total_refund_count;
+    }
+
+    public void setTotal_refund_count(String total_refund_count) {
+        this.total_refund_count = total_refund_count;
+    }
+
+    public String getRefund_count() {
+        return refund_count;
+    }
+
+    public void setRefund_count(String refund_count) {
+        this.refund_count = refund_count;
+    }
+
+    public String getRefund_fee() {
+        return refund_fee;
+    }
+
+    public void setRefund_fee(String refund_fee) {
+        this.refund_fee = refund_fee;
+    }
+
+    public String getOut_refund_no() {
+        return out_refund_no;
+    }
+
+    public void setOut_refund_no(String out_refund_no) {
+        this.out_refund_no = out_refund_no;
+    }
+
+    public String getRefund_id() {
+        return refund_id;
+    }
+
+    public void setRefund_id(String refund_id) {
+        this.refund_id = refund_id;
+    }
+
+    public String getRefund_channel() {
+        return refund_channel;
+    }
+
+    public void setRefund_channel(String refund_channel) {
+        this.refund_channel = refund_channel;
+    }
+
+    public String getRefund_status() {
+        return refund_status;
+    }
+
+    public void setRefund_status(String refund_status) {
+        this.refund_status = refund_status;
+    }
+
+    public String getRefund_account() {
+        return refund_account;
+    }
+
+    public void setRefund_account(String refund_account) {
+        this.refund_account = refund_account;
+    }
+
+    public String getRefund_recv_accout() {
+        return refund_recv_accout;
+    }
+
+    public void setRefund_recv_accout(String refund_recv_accout) {
+        this.refund_recv_accout = refund_recv_accout;
+    }
+
+    public String getRefund_success_time() {
+        return refund_success_time;
+    }
+
+    public void setRefund_success_time(String refund_success_time) {
+        this.refund_success_time = refund_success_time;
+    }
+}

+ 0 - 1
kmall-schedule/src/main/java/com/kmall/schedule/service/QzOrderService.java

@@ -328,7 +328,6 @@ public class QzOrderService {
                         result.getTrade_state().equalsIgnoreCase("SUCCESS")) {
                         Date successTime = DateUtils.convertStringToDate(result.getTime_end(),
                                                                          DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
-
                         Map orderRaram = new HashMap();
                         orderRaram.put("payStatus", 2);//已支付
                         orderRaram.put("orderStatus", 201);//已支付

+ 0 - 1
kmall-schedule/src/main/resources/mybatis/mapper/QzOrderMapper.xml

@@ -66,7 +66,6 @@
         AND a.is_onffline_order = 0
     </select>
 
-
     <update id="updateOrderInfo" parameterType="map">
         UPDATE mall_order a
         <set>