您的位置:首页 > 产品设计 > UI/UE

交易路由无法找到正确的QUEUE_ID

2017-09-15 14:18 78 查看
路由模块会通过查NS_TUNNEL_QUEUE_RULE表来找QUEUE_ID,QUEUE_ID就是service_id,写进报文中,用来找下一个模块的。

下面是该SQL在交易路由模块中的具体位置

//TODO是标记,表示应该进入该方法

List<TunnelTemp> tunnelTempList2 = this.checkChannel(tunnelTempList, serviceRequest); // 通道筛选,得到可用通道列表
if ((tunnelTempList2 != null) && (tunnelTempList2.size() > 0)) {
List<TunnelTemp> availableList = this.checkTunnelMaintenance(tunnelTempList2, serviceRequest); // 通道银行支付类型维护检查
if ((availableList != null) && (availableList.size() > 0)) {// 通道筛选完毕,进入通道限额处理检查
this.dealWith(availableList, serviceRequest);//TODO
} else {
String errorString = RespCodeUtils.createRetInfo(RespCodeConstants.OPERATOR_SYS,
RespCodeConstants.RES_CODE_0516_MSG);
updateBillSimpleException(serviceRequest, errorString, RespCodeConstants.RES_CODE_0516);// 路由失败处理
return; // 异常终止路由流程
}


private void dealWith(List<TunnelTemp> tunnelTempList, ServiceRequest serviceRequest) throws EsbException {
MsgObject mo = serviceRequest.getMo();// 获取消息对象
String msgId = mo.getRequestMsgParameter(TradePointConstants.MSG_ID);
String txnId = mo.getRequestMsgParameter(TradePointConstants.TXN_ID);// 交易ID
String tunnelId = tunnelTempList.get(0).getTunnelid(); // 通道ID
String exMerchId = tunnelTempList.get(0).getExMerchId();// 商户Id
String pmtTp = tunnelTempList.get(0).getPaymode();
String payModeMo = mo.getRequestMsgParameter(TradePointConstants.PMT_TP);
Log.getInstance().bizDebug("[txnId:" + txnId + "]鉴权交易路由使用路由规则的支付类型替换报文支付类型:" + payModeMo + "->" + pmtTp, msgId);
mo.setRequestMsgParameter(TradePointConstants.PMT_TP, pmtTp);

JSONArray jarray = this.tunnelMerch2Json(tunnelTempList, tunnelId, exMerchId, pmtTp);
mo.setRequestMsgParameter(TradePointConstants.ROUTE_SWITCH_LIST, jarray.toJSONString()); // 设置可切换路由列表
this.sendRouteResult(serviceRequest, tunnelId, exMerchId);//TODO
}


private void sendRouteResult(ServiceRequest serviceRequest, String tunnelId, String exMerchId) throws EsbException {
try {
MsgObject mo = serviceRequest.getMo();// 获取消息对象
String txnId = mo.getRequestMsgParameter(TradePointConstants.TXN_ID);// 系统单ID
String pmtTp = mo.getRequestMsgParameter(TradePointConstants.PMT_TP);// 支付模式
String msgId = mo.getRequestMsgParameter(TradePointConstants.MSG_ID);
// 设置MO的状态
mo = BussinessUtil.buildTradeSendMsg(serviceRequest, exMerchId, tunnelId);
mo.setRequestMsgParameter(TradePointConstants.MSG_STS, Constant.MSG_SUCCESS);
long start = System.currentTimeMillis();
tradeRouteDao.updateBillSimpleByTxnId(txnId, exMerchId, tunnelId, Constant.MSG_SUCCESS);
long end = System.currentTimeMillis();
Log.getInstance().bizDebug("【共耗时-" + (end - start) + "-毫秒】【SQL】【路由成功更新简表状态】【系统单号" + txnId + "】", msgId);
TunnelQueueRule tunnelQueueRule = this.tradeRouteDao.selectTunnelQueueRule(tunnelId, pmtTp); // 查询通道mq队列规则//TODO
this.routeServiceCmqProxy.sendTunnelQueueByConfig(serviceRequest, tunnelQueueRule);
try {
this.tradeRouteDao.insertNsTradeRouteStatus(mo2NsTradeRouteStatus(mo)); // 记录路由轨迹
} catch (Exception e) {
Log.getInstance().bizError(e, txnId);
Log.getInstance().stdError("鉴权路由记录路由轨迹异常", txnId);
}
Log.getInstance().bizDebug("[txnId:" + txnId + "]联机路由成功!tunnelId:" + tunnelId + "<-|exMerchId:" + exMerchId,

4000
msgId);
} catch (Exception e) {
throw new EsbException("联机路由处理失败!", e, serviceRequest, AbstractMsgReceiveSend
.getMsgBufferInstance("SynQueueResSendBuffer.Instance"));
}
}


dao层的SQL如下:



SELECT ID, TUNNEL_ID ,PMT_TP, QUEUE_TP, QUEUE_ID, QUEUE_NAME, VALID_FLG, IS_ACTUAL

FROM NS_TUNNEL_QUEUE_RULE WHERE TUNNEL_ID = #tunnelId:VARCHAR# AND PMT_TP = #pmtTp:VARCHAR#

AND VALID_FLG = ‘1’

然后你可以把参数填进去,执行一下,比如:

SELECT ID, TUNNEL_ID ,PMT_TP, QUEUE_TP, QUEUE_ID, QUEUE_NAME, VALID_FLG, IS_ACTUAL FROM NS_TUNNEL_QUEUE_RULE WHERE TUNNEL_ID = ‘ZS’

如果没有,就需要新增code了,新增code的SQL如下:

insert into NS_TUNNEL_QUEUE_RULE (ID,TUNNEL_ID,PMT_TP,QUEUE_TP,QUEUE_ID,QUEUE_NAME,VALID_FLG,IS_ACTUAL,CREATE_TIME,CREATOR,MODIFY_TIME,UPDATER) values (sys_guid(),’ZS’,’41’,’01’,’20151003’,’jspt_asyn_ZsShortcutAuthTrade’,’1’,’Y’,sysdate,’system’,sysdate,’system’)

需要注意的字段,TUNNEL_ID不说了,

二要素鉴权 PMT_TP = 41

三要素鉴权 PMT_TP = 43

四要素鉴权 PMT_TP = 42,

QUEUE_ID看你需要跳转到哪个通道入口了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  sql
相关文章推荐