package com.miniframe.generate.comm.httppayapater; import com.miniframe.spring.httpclient.MFHttpRespInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.LinkedHashMap; import java.util.Map; import com.miniframe.core.Transmitter; import com.miniframe.core.ext.UtilTools; import com.miniframe.generate.comm.pay.D_XP1004; import com.miniframe.generate.comm.pay.D_PAYHEAD; import com.miniframe.generate.business.pay.model.XP1004BaseModel; public class XP1004Client { private static final Logger logger = LoggerFactory.getLogger(XP1004Client.class); private MFHttpRespInfo respInfo; public MFHttpRespInfo getRespInfo(){ return respInfo; } /** * 调用 [支付服务->查询退款((XP1004)]的通讯接口 * @param model 接口模型 * @param extMap 扩展输入 * @param url 请求地址 * @return model 接口模型 * @throws Exception */ @SuppressWarnings({ "rawtypes", "unchecked" }) public XP1004BaseModel execute(XP1004BaseModel model,final Map extMap,final String url) throws Exception { this.executeToRespInfo(model,extMap,url); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public XP1004BaseModel execute(XP1004BaseModel model,final Map extMap) throws Exception { this.executeToRespInfo(model,extMap,null); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public MFHttpRespInfo executeToRespInfo(XP1004BaseModel model,final Map extMap,final String url) throws Exception { if (logger.isDebugEnabled()) { logger.debug("execute(XP1004BaseModel) - start"); } if(UtilTools.isNullOrBlank(model.getA_payhead().getTransCode())){ model.getA_payhead().setTransCode("XP1004"); } Map inMap = new LinkedHashMap(); inMap.putAll(UtilTools.obj2Map(model.getA_payhead())); inMap.putAll(UtilTools.obj2Map(model.getA_xp1004())); if(extMap!=null && extMap.size()>0){ inMap.putAll(extMap); } Transmitter httppayApater = (Transmitter) UtilTools.getBean("httppayApater"); MFHttpRespInfo respInfo; if(UtilTools.isNotNullAndBlank(url)){ respInfo = httppayApater.doPostDataToRespInfo(inMap,url); }else{ respInfo = httppayApater.doPostDataToRespInfo(inMap); } if(respInfo!=null) { Map outMap=respInfo.getParamMap(); D_PAYHEAD d_payhead = UtilTools.map2Obj(outMap, D_PAYHEAD.class); D_XP1004 d_xp1004 = UtilTools.map2Obj(outMap, D_XP1004.class); model.setD_payhead(d_payhead); model.setD_xp1004(d_xp1004); } if (logger.isDebugEnabled()) { logger.debug("execute(XP1004BaseModel) - end"); } this.respInfo=respInfo; return respInfo; } @SuppressWarnings({ "rawtypes", "unchecked" }) public XP1004BaseModel execute(XP1004BaseModel model) throws Exception { return this.execute(model,null,null); } }