package com.miniframe.generate.comm.httpmdoapater; 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.mdo.D_MDO2003; import com.miniframe.generate.comm.mdo.D_MDOHEAD; import com.miniframe.generate.business.mdo.model.MDO2003BaseModel; public class MDO2003Client { private static final Logger logger = LoggerFactory.getLogger(MDO2003Client.class); private MFHttpRespInfo respInfo; public MFHttpRespInfo getRespInfo(){ return respInfo; } /** * 调用 [系统服务->噪声AFnoise参数删除((MDO2003)]的通讯接口 * @param model 接口模型 * @param extMap 扩展输入 * @param url 请求地址 * @return model 接口模型 * @throws Exception */ @SuppressWarnings({ "rawtypes", "unchecked" }) public MDO2003BaseModel execute(MDO2003BaseModel model,final Map extMap,final String url) throws Exception { this.executeToRespInfo(model,extMap,url); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public MDO2003BaseModel execute(MDO2003BaseModel model,final Map extMap) throws Exception { this.executeToRespInfo(model,extMap,null); return model; } @SuppressWarnings({ "rawtypes", "unchecked" }) public MFHttpRespInfo executeToRespInfo(MDO2003BaseModel model,final Map extMap,final String url) throws Exception { if (logger.isDebugEnabled()) { logger.debug("execute(MDO2003BaseModel) - start"); } if(UtilTools.isNullOrBlank(model.getA_mdohead().getTransCode())){ model.getA_mdohead().setTransCode("MDO2003"); } Map inMap = new LinkedHashMap(); inMap.putAll(UtilTools.obj2Map(model.getA_mdohead())); inMap.putAll(UtilTools.obj2Map(model.getA_mdo2003())); if(extMap!=null && extMap.size()>0){ inMap.putAll(extMap); } Transmitter httpmdoApater = (Transmitter) UtilTools.getBean("httpmdoApater"); MFHttpRespInfo respInfo; if(UtilTools.isNotNullAndBlank(url)){ respInfo = httpmdoApater.doPostDataToRespInfo(inMap,url); }else{ respInfo = httpmdoApater.doPostDataToRespInfo(inMap); } if(respInfo!=null) { Map outMap=respInfo.getParamMap(); D_MDOHEAD d_mdohead = UtilTools.map2Obj(outMap, D_MDOHEAD.class); D_MDO2003 d_mdo2003 = UtilTools.map2Obj(outMap, D_MDO2003.class); model.setD_mdohead(d_mdohead); model.setD_mdo2003(d_mdo2003); } if (logger.isDebugEnabled()) { logger.debug("execute(MDO2003BaseModel) - end"); } this.respInfo=respInfo; return respInfo; } @SuppressWarnings({ "rawtypes", "unchecked" }) public MDO2003BaseModel execute(MDO2003BaseModel model) throws Exception { return this.execute(model,null,null); } }