package com.jkcredit.invoice.credit; import com.jkcredit.invoice.common.DataResult; import com.jkcredit.invoice.component.StatisRequestIdTimeComp; import com.jkcredit.invoice.credit.custInterface.CustomerInterLowerService; import com.jkcredit.invoice.credit.custInterface.NoCarInterService; import com.jkcredit.invoice.credit.custInterface.SelfCarInterService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("interfaceCheckServer") @Slf4j public class InterfaceCheckServer { @Autowired CustomerInterLowerService customerInterLowerService; @Autowired SelfCarInterService selfCarInterService; @Autowired NoCarInterService noCarInterService; @Autowired StatisRequestIdTimeComp statisRequestIdTimeComp; //跳转到对应的Service服务处理逻辑 public DataResult doJumpHandler(String appKey, String api, String data,String requestid ) { log.info("[-InterfaceCheckServer.doJumpHandler-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid); DataResult resultTimeOut = new DataResult(); resultTimeOut.setData(3); resultTimeOut.setCode(200); resultTimeOut.setRequestid(requestid); resultTimeOut.setMsg("网络异常"); DataResult result; switch (api){ //----------------------------自有车、无车公共接口---------------------------------// case "COMPANY_ADD_V1"://无车、自有车企业注册 result = customerInterLowerService.customeInterRec(appKey,api,data,requestid); break; case "PROTOCOL_ADD_V1"://无车、自有车协议上传 result = customerInterLowerService.customeProtocolUpLoad(appKey,api,data,requestid); break; case "COMPANY_QUERY_V1"://无车、自有车企业查询 result = customerInterLowerService.customeInterRecQuery(appKey,api,data,requestid); break; //----------------------------自有车下游接口---------------------------------// case "CARD_BIND_QUERY_LIST_V1"://自有车 用户卡列表查询 result = selfCarInterService.customerETCQuery(appKey,api,data,requestid); break; case "CARD_QUERY_CARD_V1"://自有车 卡信息查询 result = selfCarInterService.customerQueryEtcInfo(appKey,api,data,requestid); break; case "CARD_BINDING_V1"://自有车 下发短信验证码 result = selfCarInterService.customerETCRec(appKey,api,data,requestid); break; case "CARD_VALID_CODE_V1"://自有车 卡绑定接口 渠道调用此接口,上传用户收到的短信验证码 result = selfCarInterService.customerETCRecValid(appKey,api,data,requestid); break; case "CARD_TRADE_V1"://自有车 交易查询接口 渠道通过此接口可以查询单张卡连续90天内的交易(待开票、开票中、已开票) if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = selfCarInterService.getTradeList(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "B2B_INVOICE_APPLY_V1"://自有车 申请开票接口 渠道通过此接口可以对该公司绑定的单张卡连续90天内的交易进行开票。 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = selfCarInterService.applInvoice(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "B2B_INVOICE_QUERY_V1"://自有车 已开发票查询接口 渠道通过此接口可以根据该公司绑定的单张卡查询此卡在某个月开具的发票。 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = selfCarInterService.getSelfCarInvoicesByTime(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "B2B_INVOICE_PACKAGE_V1"://自有车 发票下载 渠道通过此接口可以下载某公司某个月份开具的发票。 result = selfCarInterService.getSelfCarInvoicePackage(appKey,api,data,requestid); break; case "CARD_UNBIND_V1"://自有车 卡解绑接口。 result = selfCarInterService.customerCarUnRec(appKey,api,data,requestid); break; //----------------------------无车下游接口---------------------------------// case "VEHICLE_REGISTER"://无车 车辆备案接口 result = noCarInterService.customerCarRec(appKey,api,data,requestid); break; case "VEHICLE_REGISTER_QUERY"://无车 车辆备案查询接口 result = noCarInterService.customeRecUpperQuery(appKey,api,data,requestid); break; case "WAY_BILL_START"://无车 实时运单开始指令 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = noCarInterService.noCarBillStart(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "WAY_BILL_END"://无车 实时运单结束指令 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = noCarInterService.noCarBillEnd(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "WAY_BILL_HISTORY_START"://无车 历史运单开始指令 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = noCarInterService.noCarHisWaybillStart(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "WAY_BILL_HISTORY_END"://无车 历史运单结束指令 if(StatisRequestIdTimeComp.isLimit){ result = resultTimeOut; }else{ statisRequestIdTimeComp.putReQuestIdAndTime(requestid); result = noCarInterService.noCarHisWaybillEnd(appKey,api,data,requestid); statisRequestIdTimeComp.removeReQuestIdAndTime(requestid); } break; case "WAY_BILL_NUM_FIND_INVOICE"://无车 运单号查询发票数据 result = noCarInterService.noCarVoiceQuery(appKey,api,data,requestid); break; case "FIND_NO_SEARCH_NUM"://无车 获取未查询过发票的运单编号 result = noCarInterService.noCarNoVoiceQuery(appKey,api,data,requestid); break; case "BALANCE_QUERY"://无车 账号余额查询接口 result = noCarInterService.balanceQuery(appKey,api,data,requestid); break; default: result = null; break; } log.info("[-InterfaceCheckServer.doJumpHandler-] result appKey=" + appKey + " ,api=" + api + " ,data=" +data + " ,requestid=" +requestid+ " ,result="+result); return result; } }