关键代码
/*调用微信查询订单接口*/Map<String, String> orderqueryRes = orderquery(wXH5Pay,params.get("out_trade_no"));
/*交易成功*/
if (!"SUCCESS".equals(orderqueryRes.get("trade_state"))){
throw new Exception("<===微信支付失败====>订单号为【"+ params.get("out_trade_no")+ "】的订单");
}
/**
* 查询支付结果 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2
*/
private static Map<String, String> orderquery(WXPay wxpay, String outTradeNo) throws Exception {
Map<String, String> parament = new HashMap<String, String>();
parament.put("out_trade_no", outTradeNo);
return wxpay.orderQuery(parament);
}