public String weChatNotify(String request) { try { Map<String, String> reqParams = WeChatUtils.decodeXML(request); if (reqParams == null) { return WeChatUtils.buildNotifyFailXML(); } if (!Constants.WECHAT_CODE_RET_SUCCESS.equals(reqParams.get("return_code"))) { return WeChatUtils.buildNotifyFailXML(); } if (!Constants.WECHAT_CODE_RET_SUCCESS.equals(reqParams.get("result_code"))) { return WeChatUtils.buildNotifyFailXML(); } // 回调通知信息入库 insertPayNotify(reqParams); // 订单信息更新 PayOrder payOrderUpdate = updatePayOrderByPayChannel(reqParams, Constants.PAY_CHANNEL_WECHAT); // 通知O2O String outNotifyUrl = payOrderUpdate.getOutNotifyUrl(); int payId = payOrderUpdate.getPayId(); String outOrderId = payOrderUpdate.getOutOrderId(); String retCode = payOrderUpdate.getPayStatus(); String retMsg = payOrderUpdate.getPayChnDesc(); String merPriv = payOrderUpdate.getMerPriv(); notifyService.notifyO2O(outNotifyUrl, payId, outOrderId, retCode, retMsg, merPriv); return WeChatUtils.buildNotifySUCCESSXML(); } catch (Exception e) { return WeChatUtils.buildNotifyFailXML(); } }